MySQL从库报错Slave I/O for channel ”: Got fatal error 1236 from master when reading data from binary log: ‘Could not find first log file name in binary log index file’, Error_code: 1236
今天在查看MySQL 主从 ,从库报错 Slave_IO_Running: No ,查看msyql 错误日志报错:11 [ERROR] Error reading packet from server for channel ”: Could not find first log file name in binary log index file (server_errno=1236)
解决方法:
在master 主库上执行刷新日志
mysql> flush logs; Query OK, 0 rows affected (0.00 sec) mysql> show master status\G; *************************** 1. row *************************** File: mysql-bin.000003 Position: 154 Binlog_Do_DB: Binlog_Ignore_DB: Executed_Gtid_Set: 1 row in set (0.00 sec)
停止从库主从复制,并设置CHANGE
mysql> stop slave; Query OK, 0 rows affected (0.01 sec) # 设置 mysql> CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000003',MASTER_LOG_POS=154; Query OK, 0 rows affected (0.00 sec) #启动从库 mysql> start slave; Query OK, 0 rows affected (0.01 sec)
启动从库后检查 主从状态,发现恢复
mysql> show slave status\G *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 172.16.1.6 Master_User: rep Master_Port: 3306 Connect_Retry: 60 Master_Log_File: mysql-bin.000003 Read_Master_Log_Pos: 154 Relay_Log_File: mysql02-relay-bin.000002 Relay_Log_Pos: 320 Relay_Master_Log_File: mysql-bin.000003 Slave_IO_Running: Yes Slave_SQL_Running: Yes