1.检查从库
show slave status \G;
Slave_IO_Running: Yes
Slave_SQL_Running: No
2.出现类似如下的报错:
Last_SQL_Error: Error 'Duplicate entry '1001-164761-0' for key 'PRIMARY'' on query. Default database: 'bug'. Query: 'insert into misdata (uid,mid,pid,state,mtime) values (164761,1001,0,-1,1262623560)'
3.解决方案:
在丛库上,执行以下命令,跳过它:
先停止slave:stop slave; set global sql_slave_skip_counter = 1
再启动slave:start slave; 说明:执行一次后查看是否正常,不正常再继续执行该命令
或者在从库的my.cnf中加上这条:
slave-skip-errors = 1062