mysql5.7 主从GTID错误

错误信息
mysql5.7 GTID错误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.'
解决:
主库查看master gtid_purged
show global variables like '%gtid%';
 找到gtid_purged的值
从库执行:
复制代码
mysql> stop slave;
Query OK, 0 rows affected (0.18 sec)
mysql> reset slave;
Query OK, 0 rows affected (1.29 sec)
mysql> reset master;
Query OK, 0 rows affected (1.18 sec)
mysql>  set @@global.gtid_purged='gtid_purged的值';
Query OK, 0 rows affected (2.12 sec)
mysql> change master to master_host='MASTER_IP',master_port=PORT,master_user='USERNAME',master_password='PASSWORD',master_auto_position=1;
Query OK, 0 rows affected, 2 warnings (5.55 sec)
mysql> start slave;
Query OK, 0 rows affected (0.40 sec)
mysql> show slave status \G;
posted @ 2022-07-20 17:03  巴黎斜塔  阅读(227)  评论(0编辑  收藏  举报