Sometimes, MySQL replication may break, displaying an error in ‘show slave status’ such as:
mysql> show slave status\G ********************* 1. row ********************* Last_Errno: 1062 Last_Error: Error 'Duplicate entry '123456' for key 1' on query. Default database: 'XXX'. Query: 'YYY' Skip_Counter: 0
When you see this, you can try to increment the counter by:
mysql> stop slave; mysql> set global sql_slave_skip_counter=1; start slave;
Then rerun the ‘show slave status’ again to see if replication is now working again. If you start seeing many of these, it could possibly indicate that your replication is not consistent between the Master and Slave MySQL servers, and you may need to consider rebuilding replication.