mysql主从切换摘要

1、需要提升为主的从库,停止io线程等待slave数据全部更新完毕

stop slave IO_THREAD 

#show processlist的输出,直到看到状态是Slave has read all relay log; waiting for the slave I/O thread to update it,表示更新都执行完毕

2、需要提升为主的从库:

stop slave 停止slave
reset master
grant replication slave on *.* to 'repl'@'192.168.0.100' identified by '123456';
reset slave all

3、其他从库

stop slave
change master #到新主库
start slave

删除新主服务器上的master.info和relay-log.info文件

原文地址:https://www.cnblogs.com/fanxuanhui-linux/p/6036404.html