Hi Chaps, I have a CMD prompt script that will dump only the data from my database (dbjobs): mysqldump -u 'username' -p'password' --no-create-info --complete-insert dbjobs > c:/database_data_only.sql Code (markup): But when I try to restore the data, I get multiple errors: e.g. ERROR 1062 (23000): Duplicate entry '1' for key 1 Code (markup): Is there something that I can add to the mysqldump command that will solve this issue?
In this case no. You are trying to insert a duplicate value for a key. You need to figure out why there are multiple rows with the value of '1' in this key column. If you have a 0 value in the first row it's possible that Mysql is giving that row a value of 1, which then breaks any subsequent inserts. Mysql doesn't like 0 as a value. If you run into foreign key violations when restoring, you can run: SET foreign_key_checks = 0; before the restore and then SET foreign_key_checks = 1; when you're done.
Hi, I found TRUNCATE, which should delete the contents of the table, but don't know if it can be added to the mysqldump options????