一台机器上同时启用多个MySQL进程

修改/etc/my.cnf

vim /etc/my.cnf

1. 注释掉以下字段

[mysqld_safe]

2.添加如下信息

[mysqld_multi]
mysqld = /usr/local/mysql/bin/mysql_safe    ##mysql_safe 绝对路径
mysqladmin = /usr/local/mysql/bin/mysqladmin     ##mysqladmin绝对路径
user = mysql   ##访问权限

[mysqld1]   ##mysql进程1
port = 3306  ## 端口
socket = /tmp/mysql.sock1 ##sock文件文字  
pid-file=/usr/local/mysql/data1/db-app1.pid  ##pid文件位置
log=/usr/local/mysql/data1/db-app.log   ##log文件文字
datadir = /usr/local/mysql/data    ##数据文件目录
user = mysql  ##用户
server-id =1

[mysqld2]
port = 3307
socket = /tmp/mysql.sock2
pid-file = /usr/local/mysql/data2/db-app2.pid
datadir = /usr/local/mysql/data2
log=/usr/local/mysql/data2/db-app.log
user = mysql
server-id=2

启动

mysql_multi start 1  ##启动第一个mysql引擎

停止

mysql_multi sotp 1

你可能感兴趣的:(mysql,数据库,职场,休闲,mysql进程)