ERROR 1858 (HY000): sql_slave_skip_counter can not be set when the server is running with GTID_MO...

发现Mysql主从不同步,找到解决方案:
mysql > stop slave;
mysql > set global sql_slave_skip_counter =1;
mysql > start slave;
但是在执行第二步的时候报错:
ERROR 1858 (HY000): sql_slave_skip_counter can not be set when the server is running with GTID_MODE = ON. Instead, for each transaction that you want to skip, generate an empty transaction with the same GTID as the transaction

通过分析原来是Gtid的同步方式,需要通过Gtid来修复
mysql> show slave status\G;


image.png

上图中是表示正常的。懒的模拟环境了,比如有下列情况:
Retrieved_Gtid_Set: ffd80980-c7cb-11e9-beda-0050569051da:1-8 检索到主已经8个事务了。
ffd80980-c7cb-11e9-beda-0050569051da这个是表示主的UUID,唯一的
Executed_Gtid_Set: c46aebe0-c8e9-11e9-8057-005056a20520:1-135710,
ffd80980-c7cb-11e9-beda-0050569051da:1-7 表示从上已经执行了7个事务了。
如果是这种情况,可采用下列方法修复:
mysql > stop slave;
mysql >SET GTID_NEXT=' ffd80980-c7cb-11e9-beda-0050569051da:8';
mysql > begin;commit;
mysql > SET GTID_NEXT="AUTOMATIC";
mysql > start slave;

你可能感兴趣的:(ERROR 1858 (HY000): sql_slave_skip_counter can not be set when the server is running with GTID_MO...)