1.跳过指定数量的事务:
slave stop;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1 #跳过一个事务
slave start
2.修改mysql的配置文件,通过slave_skip_errors参数来跳所有错误或指定类型的错误
[mysqld]
#slave-skip-errors=1062,1032 #跳过指定error no类型的错误
#slave-skip-errors=all #跳过所有错误
错误
1032:更新或者删除找不到记录
#当删除的列在从库,不存在
Last_SQL_Errno: 1032
Last_SQL_Error: Could not execute Delete_rows event on table school.student02; Can't find record in 'student02',
Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000001, end_log_pos 1431
#当更新的列在从库,不存在(报错和上面一样)
Last_SQL_Errno: 1032
Last_SQL_Error: Could not execute Update_rows event on table school.student02; Can't find record in 'student02',
Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000001, end_log_pos 1789
1062: 主键冲突
Last_SQL_Errno: 1062Last_SQL_Error: Couldnot execute Write_rows event on table school.student02; Duplicate entry '7' for key 'PRIMARY',
Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log mysql-bin.000001, end_log_pos 2137