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

  • 相关阅读:
    java 新建文件夹保存
    android AppWidgwtProvider学习
    GPS定位
    android ContentProvider学习
    Android 解屏幕锁与点亮屏幕(来电时效果)
    RecyclerView 分页滑动,设置可以滑动下一页,下一个item作为起点方法
    Glide 加载图片 到动态ImageView
    一个例子了解 HandlerThread,Looper,ThreadLocal,Handler,MessageQueue,Message的关系
    android TabLayout 相关
    屏幕相关
  • 原文地址:https://www.cnblogs.com/itfenqing/p/10333232.html
Copyright © 2011-2022 走看看