How to restore data from MYSQL dump without any duplicate key errors?
-
17-09-2020 - |
Question
Everytime I try restoring the dump, I get :
ERROR 1062 (23000) at line 10297: Duplicate entry 'spaß' for key 'PRIMARY'
I am trying to restore it using:
mysql -u root -ppassword database < 0719.sql
Solution
You could import the dump into a temporary table, than use an SQL statement to copy only rows from this temporary table which do are not found in the target table.
OTHER TIPS
you should truncate or drop the table in which you get duplicates
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow