Sunday 10 February 2013

MySQL Slave Replication error 1062 ' Duplicate entry'

MySQL Slave Replication shows error 1062 'Duplicate Entry' for some data, it simply means that slave binlog is reading the incorrect position from Master server's binlog, which stops the replication.
Here you can troubleshoot this error using following methods :

1) mysql>STOP SLAVE; SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE;
You may require to perform this step several times as you may have multiple duplicate entries for your slave server.

2) slave-skip-errors = 1062
You can directly add the particular error No. ie. 1062 in your my.cnf .
Or you can add multiple error codes like
slave-skip-errors = [error_code1, error_code2,......]


For All error codes you can refer to Click Here