1.master和slave都关闭防火墙
#systemctl stop firewalld#setenforce 0
master Mysql
#vim /etc/my.cnf[ ]log-bin=mylogserver-id=1
mysq> grant replication slave,reload,super on *.* to ‘slave‘@‘%‘ identified by ‘123‘;mysql>flush privileges;
#systemctl restart mysqld
slaveMysql
#vim /etc.my.cnf[mysqld]server-id=2
#systemctl restart mysqld
mysql> show master status \G
mysql> help change master tomysql> CHANGE MASTER TOMASTER_HOST=‘masterIP‘,MASTER_USER=‘slave‘,MASTER_PASSWORD=‘123‘,MASTER_PORT=3306,MASTER_LOG_FILE=‘mylog.000001‘,MASTER_LOG_POS=4,MASTER_CONNECT_RETPY=10;
mysql> start slave;mysql> show slave status;
原文:http://blog.51cto.com/13523939/2065649