MySQL5.7 多例項

zping發表於2018-05-25

 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

 

相關文章