MySQL Replication Error: Duplicate Entry for Key

MySQL Server

MySQL Server

On one MySQL slave server we maintain, we noticed this error

Duplicate entry '2' for key 'PRIMARY'

A quick fix was to issue this command:


Some say that there could be a data entry in the slave server and then it was being written again generating the duplicate error. Some others are of the opinion that if myisamchk was executed in the master server, it may have removed some entries and tried to create those again. The slave then attempts to write the same entry, but since myisamchk was not executed on the slave, the entry exists hence the duplication error.

Leave a Comment

Your email address will not be published.

Back to Top

© 2022 Webx Networks.