MySQL单机多实例配置

本笔记以单机两个实例

1,创建两个目录/mnt/db/mysqlmulti1和/mnt/db/mysqlmulti2,并修改属主为mysql

2,修改/etc/my.cnf,修改为

[client]

socket=/mnt/db/mysqlmulti1/mysql.sock

[mysqld_multi]

mysqld = /usr/bin/mysqld_safe

mysqladmin = /usr/bin/mysqladmin

user = root

password = 123456 #这一行需在成功启动后再加,主要用于mysql起停。

[mysqld1]

socket = /mnt/db/mysqlmulti1/mysql.sock

port = 3301

pid-file = /mnt/db/mysqlmulti1/mysql.pid

datadir = /mnt/db/mysqlmulti1/

log = /mnt/db/mysqlmulti1/mysql.log

user = mysql

[mysqld2]

socket = /mnt/db/mysqlmulti2/mysql.sock

port = 3302

pid-file = /mnt/db/mysqlmulti2/mysql.pid

datadir = /mnt/db/mysqlmulti2/

log = /mnt/db/mysqlmulti1/mysql.log

user = mysql

3,启动

mysqld_multi –defaults-extra-file=/etc/my.cnf start 1,2

停止

mysqld_multi –defaults-extra-file=/etc/my.cnf stop 1,2

本文链接地址: MySQL单机多实例配置

打赏作者
赞助/Donate

您的支持将鼓励我们继续创作!

[微信] 扫描二维码打赏

正在跳转到PayPal...

发表评论

电子邮件地址不会被公开。 必填项已用*标注

*