How to fix MySQL import Error: Duplicate entry at line

If while importing a database you encounter the following error

mysql example < example.db
Error: Duplicate entry at line: XXX

just redump the database from the original source with the –insert-ignore option:

mysqldump --insert-ignore --single-transaction example > example.db

You should now be able to import the dump without any issue and you will no longer see the message: Error: Duplicate entry at line

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.