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


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

報錯界面:

擺錯內容:

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狀態:

發現Slave_SQL_Running: No,這地方必須是兩個yes才可以同步。

執行:

STOP SLAVE;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; 
START SLAVE;

再查看slave狀態:

slave_sql_running和Slave_IO_Running,分別負責slave mysql進程和與主機的io通信全部是yes,成功!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM