zoukankan      html  css  js  c++  java
  • mysql 多实例

    一.安装mysql

    二.配置my.cnf

    [mysqld3306]
    port=3306
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql3306.sock
    pid-file=/var/run/mysqld/mysqld3306.pid
    log-error = /var/lib/mysql/error.log
    
    # Disabling symbolic-links is recommended to prevent assorted security risks
    symbolic-links=0
    
    # Recommended in standard MySQL setup
    sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
    
    [mysqld3307]
    port=3307
    datadir=/var/lib/mysql3307
    socket=/var/lib/mysql3307/mysql3307.sock
    pid-file=/var/run/mysqld/mysqld3307.pid
    log-error = /var/lib/mysql3307/error.log
    
    # Disabling symbolic-links is recommended to prevent assorted security risks
    symbolic-links=0
    
    # Recommended in standard MySQL setup
    sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
    
    
    [mysqld3308]
    port=3308
    datadir=/var/lib/mysql3308
    socket=/var/lib/mysql3308/mysql3308.sock
    pid-file=/var/run/mysqld/mysqld3308.pid
    log-error = /var/lib/mysql3308/error.log
    
    # Disabling symbolic-links is recommended to prevent assorted security risks
    symbolic-links=0
    
    # Recommended in standard MySQL setup
    sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
    
    
    [mysqld_multi]
    mysqld = /usr/bin/mysqld_safe
    mysqladmin = /usr/bin/mysqladmin
    
    [mysqld_safe]
    log-error=/var/log/mysqld.log
    pid-file=/var/run/mysqld/mysqld.pid
    

      

    三.创建和初始化数据目录

    1.在/var/lib下创建mysql3307和mysql3308

    2.赋予权限

    chown mysql:mysql /var/lib/mysql3307
    .....
    

      

    3.初始化:

    ...
    mysql_install_db --basedir=/usr/local/mysql/ --datadir=/var/lib/mysql3307 --defaults-file=/etc/my.cnf
    ...
    

      

    四.多实例管理

    启动全部实例:/usr/local/mysql/bin/mysqld_multi start
    查看全部实例状态:/usr/local/mysql/bin/mysqld_multi report
    启动单个实例:/usr/local/mysql/bin/mysqld_multi start 3306
    停止单个实例:/usr/local/mysql/bin/mysqld_multi stop 3306
    查看单个实例状态:/usr/local/mysql/bin/mysqld_multi report 3306

  • 相关阅读:
    【C#】工具类-FTP操作封装类FTPHelper
    网盘搜索网站
    在线服务
    Windows下安装NTP服务器
    vue 组件间的传值 + 路由守卫
    功能6 -- 选项卡数据缓存
    vue2.0/3.0
    vuex
    mySql笔记
    Typescript
  • 原文地址:https://www.cnblogs.com/itfenqing/p/10333232.html
Copyright © 2011-2022 走看看