Mysql主从失败, 错误Got fatal error 1236解决方法

来自linux中国网wiki
跳转至: 导航搜索

mysql主从失败, 错误Got fatal error 1236解决方法

问题出现

(vm机器 几天不用 再启动就) 由于主服务器异外重启, 导致从报错, 错误如下:

show slave status错误:

Slave_IO_Running: No

     Last_IO_Errno: 1236
                Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file'
              
查看mysql err log 如下  

2017-08-22 10:56:23 9100 [Note] Slave I/O thread: connected to master 'repl_user@192.168.30.77:3306',replication started in log 'mysql-bin.000010' at position 120

2017-08-22 10:56:23 9100 [ERROR] Error reading packet from server: Could not find first log file name in binary log index file (server_errno=1236)
2017-08-22 10:56:23 9100 [ERROR] Slave I/O: 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
2017-08-22 10:56:23 9100 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.000010', position 120
2017-08-22 10:56:23 9100 [Warning] Slave SQL: If a crash happens this configuration does not guarantee that the relay log info will be consistent, Error_code: 0

=解决办法

按照习惯, 先尝试必改position位置.
mysql> stop slave; 
mysql> change master to master_log_file='mysql-bin.000011',master_log_pos=203; 
mysql> start slave; 

show slave status\G 

居然就成功了

有个悲伤的就是 海外最终于还是没解决这个问题     

=参考资料

MySQL主从失败, 错误Got fatal error 1236解决方法

一次MySQL主从搭建出现“Last_IO_Errno: 1236”错误的处理记录

【MySQL】Got fatal error 1236原因和解决方法