在从库更新主库信息报错
错误:
ERROR 3021 (HY000): This operation cannot be performed with a running replica io thread; run STOP REPLICA IO_THREAD FOR CHANNEL '' first.
解决方法:
1、停止从服务器的I/O线程
STOP REPLICA IO_THREAD;
注意:mysql8.0+中,SLAVE关键字已经被废弃,应该使用REPLICA关键字。在mysql5.7及之前版本中,可以使用STOP SLAVE IO_THREAD;
2、等待I/O线程停止,可以通过检查从服务器的状态确认
SHOW SLAVE STATUS \G;
3、重新执行change master to语句来更新主服务器信息
change master to master_host='192.168.2.177',master_user='slave',master_password='123456',master_port=3306,master_log_file='binlog.000071',master_log_pos=1672;
4、启动从服务器的I/O线程,如果是mysql5.7及更早版本,使用START SLAVE IO_THREAD;
START REPLICA IO_THREAD;
5、检查从服务器的状态以确保复制正常运行
SHOW SLAVE STATUS \G;