MySQL5.7 多实例

 1,先按MySQL5.7安装好后

    mkdir dbdata_3307

    chown mysql:mysql -R dbdata_3307

 2,./bin/mysqld  --initialize --user=mysql  --basedir=/usr/local/mysql --datadir=/usr/local/mysql/dbdata_3307  -- 1个实例

 3,./bin/mysqld  --initialize --user=mysql  --basedir=/usr/local/mysql --datadir=/usr/local/mysql/dbdata_3308   --另一个实例

 4,启动:  mysql -uroot -p -S /tmp/mysql3307.sock

                   mysql -uroot -p -S /tmp/mysql3308.sock

 修改My.cnf

   

[mysqld_multi]
  mysqld=/usr/local/mysql/bin/mysqld_safe
  mysqladmin =/usr/local/mysql/bin/mysqladmin
  user = admin      
  password = 123   
  
  [mysqld3307]
  socket = /tmp/mysql3307.sock
  port = 3307
  pid-file = /usr/local/mysql/dbdata_3307/mysql3307.pid
  datadir = /usr/local/mysql/dbdata_3307
  basedir = /usr/local/mysql
  user = mysql
  server-id=3307
  
  [mysqld3308]
  socket = /tmp/mysql3308.sock
  port = 3308
  pid-file =/usr/local/mysql/dbdata_3308/mysql3308.pid
  datadir = /usr/local/mysql/dbdata_3308
  basedir = /usr/local/mysql
  user = mysql
  server-id=3308

 

   启动: mysqld_multi start 3307

   查看状态:mysqld_multi report 3307

 

posted @ 2018-05-25 13:51  zping  阅读(255)  评论(0编辑  收藏  举报