初始主从状态
vi /etc/my.cnf
文件最后添加
server-id=1
log-bin=/var/lib/mysql/mysql-bin
systemctl restart mysqld.service
初始主从状态
vi /etc/my.cnf
在末尾加入一行:
server-id=2
systemctl restart mysqld.service
从机执行:
stop slave;
set GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
reset slave;
start slave;
show slave status\G;