MySQL : Replication Error 1062
One of the common error in MySQL Replication is ‘Duplicate Entry’ – Error 1062. This pop-ups only if there are any manual intervention.
The SQL Thread stops with this error. Just check the record in the error on both master and slave. If you understand the exact cause, you may delete the record in slave and start replication. Or else, just skip ignore the insert statement using the below command:
mysql> STOP SLAVE;
mysql> SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
mysql> START SLAVE;
This will skip 1 statement and continues replication. If you’re getting lot of such errors, again and again, just add the below entry in Slave’s my.cnf and restart MySQL:
[mysqld]
.
.
slave_skip_errors = 1062
This will keep on skipping duplicate entries whenever it occurs.
Please note that, you can use this for any other error, as well.