MySQL Replication on 5.5 Slave is Getting 'Duplicate Key' Errors

(Doc ID 1482324.1)

Last updated on MARCH 08, 2017

Applies to:

MySQL Server - Version 5.5 and later
Information in this document applies to any platform.


On : 5.5 version, Replication (General and Statement)

When attempting to replicate the following error occurs.

120720 16:21:16 [Warning] Slave: Duplicate entry '1583' for key 'PRIMARY' Error_code: 1062

The issue can be reproduced at will with the following steps:
1. Take a backup using mysqldump with --flush-logs and --single-transaction used for the command.
  While the backup is being performed, transactions should be running that are updating/inserting data.
2. Restore the slave using the backup taken.
3. Start replication.

The issue has the following business impact:
Due to this issue, users cannot guarantee a working replication due to inconsistency.


The 5.5 version FLUSH LOGS command causes an implicit COMMIT to occur, which is also reproduced using the mysql_refresh() C API function call.


Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms