MySQL跳过错误的方法

 

1、普通复制


mysql> stop slave;
#表示跳过一步错误,后面的数字可变,(或者N条event,一条一条跳过)
mysql> set global sql_slave_skip_counter =1;
mysql> start slave;
之后再用mysql> show slave status/G 查看:

 

2、GTID复制


STOP SLAVE;
SET @@SESSION.GTID_NEXT= '8f9e146f-0a18-11e7-810a-0050568833c8:4';
BEGIN; COMMIT;
SET SESSION GTID_NEXT = AUTOMATIC;
START SLAVE;