修改配置文件/etc/my.cnf
[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
启用服务
systemctl enable mysqld@db01
systemctl enable mysqld@db02
开启实例
systemctl start mysqld@db01
systemctl start mysqld@db01
删除服务
systemctl disable mysqld@db01
systemctl disable mysqld@db01
管理实例
mysql -S /var/lib/mysql-replica01/mysql.sock -uroot -p
mysql -S /var/lib/mysql-replica02/mysql.sock -uroot -p