排障——数据库主从复制ERROR 3021 (HY000): This operation cannot be performed with a running slave io thread

故障起因

停止一台从服务器后换上了一台新的mysql从服务器

mysql> change master to master_host='20.0.0.12',
	-> master_user='myslave',
	-> master_password='123456',
	-> master_log_file='master-bin.000002',
	-> master_log_pos=154;
ERROR 3021 (HY000): This operation cannot be performed with a running slave io thread; run STOP SLAVE IO_THREAD FOR CHANNEL '' first.

解决故障

io线程开启中无法对从服务器进行修改,因此我们需要关闭io线程

mysql> STOP SLAVE IO_THREAD;   //关闭线程
Query OK, 0 rows affected (0.00 sec)

mysql> change master to master_host='20.0.0.12',   //指定主服务器
    -> master_user='myslave',                 //管理用户名称
    -> master_password='123456',              //密码
    -> master_log_file='master-bin.000002',   //二进制文件
    -> master_log_pos=154;                    //文件位置参数

Query OK, 0 rows affected, 2 warnings (0.00 sec)    //提示成功

mysql> start SLAVE IO_THREAD;     //开启io线程
Query OK, 0 rows affected (0.01 sec)

猜你喜欢

转载自blog.csdn.net/CN_LiTianpeng/article/details/108663191