kool_samule Posted February 18, 2010 Share Posted February 18, 2010 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 But when I try to restore the data, I get multiple errors: e.g. ERROR 1062 (23000): Duplicate entry '1' for key 1 Is there something that I can add to the mysqldump command that will solve this issue? Quote Link to comment https://forums.phpfreaks.com/topic/192509-mysql-dump-restore-data-only/ Share on other sites More sharing options...
shlumph Posted February 18, 2010 Share Posted February 18, 2010 There may be an option to include drop statements, not sure off the top of my head though Quote Link to comment https://forums.phpfreaks.com/topic/192509-mysql-dump-restore-data-only/#findComment-1014310 Share on other sites More sharing options...
kool_samule Posted February 18, 2010 Author Share Posted February 18, 2010 Hi, thanks for the reply, I found TRUNCATE, but don't think you can add it to the dump options ???? Quote Link to comment https://forums.phpfreaks.com/topic/192509-mysql-dump-restore-data-only/#findComment-1014313 Share on other sites More sharing options...
shlumph Posted February 18, 2010 Share Posted February 18, 2010 Try this: mysqldump -u 'username' -p'password' --add-drop-table --no-create-info --complete-insert dbjobs > c:/database_data_only.sql Quote Link to comment https://forums.phpfreaks.com/topic/192509-mysql-dump-restore-data-only/#findComment-1014374 Share on other sites More sharing options...
kool_samule Posted February 18, 2010 Author Share Posted February 18, 2010 thanks for the reply, I think I'll dump the data only, then when restoring the data, truncate the tables, then load the data Quote Link to comment https://forums.phpfreaks.com/topic/192509-mysql-dump-restore-data-only/#findComment-1014396 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.