mysql主从复制,经常会遇到错误而导致slave端复制中断,这个时候一般就需要人工干预,跳过错误才能继续
跳过错误有两种方式:

  1. 跳过指定数量的事务:
mysql>slave stop;
mysql>SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1        #跳过一个事务
mysql>slave start
  1. 修改mysql的配置文件,通过slave_skip_errors参数来跳所有错误或指定类型的错误
vi /etc/my.cnf
[mysqld]
#slave-skip-errors=1062,1053,1146 #跳过指定error no类型的错误
#slave-skip-errors=all #跳过所有错误
  • 1062 Duplicate entry ‘1438019’ for key ‘PRIMARY’’ on query
  • 1146 Table doesn’t exist
  • 1032; handler error HA_ERR_KEY_NOT_FOUND;
  • 1060:1060 Duplicate column name ‘ID’
作者:Jeebiz  创建时间:2023-03-13 16:56
最后编辑:Jeebiz  更新时间:2024-08-22 10:23