MySQL 5.7 建立多個實例 基於CentOS 7

MySQL 5.7 建立多個實例 基於CentOS 7
修改配置文件/etc/my.cnfmysql

[mysqld@db01]
datadir=/var/lib/mysql-replica01
socket=/var/lib/mysql-replica01/mysql.sock
port=3307
log-error=/var/log/mysqld-replica01.log

[mysqld@db02]
datadir=/var/lib/mysql-replica02
socket=/var/lib/mysql-replica02/mysql.sock
port=3308
log-error=/var/log/mysqld-replica02.log

啓用服務sql

systemctl enable mysqld@db01
systemctl enable mysqld@db02

開啓實例socket

systemctl start mysqld@db01
systemctl start mysqld@db01

刪除服務ide

systemctl disable mysqld@db01
systemctl disable mysqld@db01

管理實例code

mysql -S  /var/lib/mysql-replica01/mysql.sock -uroot -p

mysql -S  /var/lib/mysql-replica02/mysql.sock -uroot -p
相關文章
相關標籤/搜索