最近遇到mysql开启gtid做复制时,主从同步断开,从库出现1236错误,导致同步无法进行,本文就这问题记录下处理步骤
Got fatal error 1236 from master when reading data from binary log: ‘The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, but the master has purged binary logs containing GTIDs that the slave requires.’
一般两种情况会出现以上现象
1.在主库上手动执行清除二进制日志文件
2.主库重启,重新同步时
解决方法:
1、在主库上执行以下命令,查询gtid_purged,记录下改值
mysql> show global variables like '%gtid%'\G
2、在从库上执行以下命令,查询已经执行过的gtid即gtid_executed,记录下主库的值,本机的不需要