mysql stop slave io_MySQL主从配置This operation cannot be performed with a running slave io thread; run ...

MySQL主从配置This operation cannot be performed with a running slave io thread; run STOP SLAVE IO_THREAD FOR CHANNEL '' first.

报错界面:

2002319-20201221181024697-37643791.png

摆错内容:

ERROR 3021 (HY000): This operation cannot be performed with a running slave io thread; run STOP SLAVE IO_THREAD FOR CHANNEL '' first.

解决办法:

1.先关闭当前的slave;

mysql> stop slave;

2.检查主服务器的配置信息:

vi /etc/my.cnf

# 文件末尾查看追加

log-bin=master-bin

binlog-format=ROW

server-id=1

binlog-do-db=msb

3.查看主的状态信息,在主MySQL下:

mysql> show master status;

+-------------------+----------+--------------+------------------+-------------------+

| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |

+-------------------+----------+--------------+------------------+-------------------+

| master-bin.000009 | 154 | msb | | |

+-------------------+----------+--------------+------------------+-------------------+

1 row in set (0.00 sec)

记住Position,完成后重新关联:

change master to master_host='192.168.182.111',master_user='root',master_password='123456',master_port=3306,master_log_file='master-bin.000001',master_log_pos=154;

查看slave状态:

413946d6633bd478e7c5097464ed6887.png

发现Slave_SQL_Running: No,这地方必须是两个yes才可以同步。

执行:

STOP SLAVE;

SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;

START SLAVE;

再查看slave状态:

023ca02f38246ab5a124276e8ab40dba.png

slave_sql_running和Slave_IO_Running,分别负责slave mysql进程和与主机的io通信全部是yes,成功!

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值