[root@minion-2 ~]# vi /etc/my.cnf
log-bin
server-id=1
授权账户并重启
mysql> grant super,reload,replication slave on ‘*.*’ to slave@192.168.0.105 identified by ‘slave‘;
mysql> flush privileges;
mysql>quit
[root@minion-2 ~]# service mysqld restart
[root@minion-2 ~]# vi /etc/my.cnf
log-bin
server-id=2
mysql>change master to master_host=‘192.168.0.104‘,master_user=‘slave‘,master_password=‘slave‘;
mysql> start slave;
至此单向的主从完毕,接下来是反过来操作一遍
mysql> grant super,reload,replication slave on ‘*.*’ to slave@192.168.0.104 identified by ‘slave‘;
mysql> flush privileges;
mysql>change master to master_host=‘192.168.0.105‘,master_user=‘slave‘,master_password=‘slave‘;
mysql> start slave;
原文:https://blog.51cto.com/popli3/2370453