Mysql 多实例配置与启停

 
  

1 安装目录

[mysql@server ~]$ ll /mysql
total 12
drwxr-xr-x  5 mysql mysql 4096 Aug  3 23:08 data
-rw-r--r--  1 mysql mysql 1843 Aug  3 22:53 multi.log
drwxr-xr-x 13 mysql mysql 4096 Aug  3 22:49 software



2 配置文件如下
[mysql@server ~]$ cat /etc/my.cnf 
[mysqld_mulit]
mysqld  = /mysql/software/bin/mysqld_safe 
mysqladmin  =  /mysql/software/bin/mysqladmin 

[mysqld3306]
socket     = /mysql/data/db_3306/mysql3306.sock   
port       = 3306  
pid-file   = /mysql/data/db_3306/mysq3306.pid   
datadir    = /mysql/data/db_3306   

[mysqld3307]
socket     = /mysql/data/db_3307/mysql3307.sock   
port       = 3307  
pid-file   = /mysql/data/db_3307/mysq3307.pid   
datadir    = /mysql/data/db_3307   

[mysqld3308]
socket     = /mysql/data/db_3308/mysql3308.sock   
port       = 3308  
pid-file   = /mysql/data/db_3308/mysq3308.pid   
datadir    = /mysql/data/db_3308   


3 启动数据库

[mysql@server ~]$ mysqld_multi start 3306  --log=/home/mysql/mysql_mulit.log 
[mysql@server ~]$ mysqld_multi start 3307  --log=/home/mysql/mysql_mulit.log 
[mysql@server ~]$ mysqld_multi start 3308  --log=/home/mysql/mysql_mulit.log 
[mysql@server ~]$ mysqld_multi report
Reporting MySQL servers
MySQL server from group: mysqld3306 is running
MySQL server from group: mysqld3307 is running
MySQL server from group: mysqld3308 is running

4 关闭数据库

[mysql@server ~]$ mysqld_multi stop  3306  --log=/home/mysql/mysql_mulit.log 
[mysql@server ~]$ mysqld_multi stop  3307  --log=/home/mysql/mysql_mulit.log 
[mysql@server ~]$ mysqld_multi stop  3308  --log=/home/mysql/mysql_mulit.log \
[mysql@server ~]$ mysqld_multi report
Reporting MySQL servers
MySQL server from group: mysqld3306 is not running
MySQL server from group: mysqld3307 is not running
MySQL server from group: mysqld3308 is not running




你可能感兴趣的:(MYSQL)