MySQL - Restore dumpfile replace syntax?

Is there a way to restore a dumpfile using mysql dbname < dumpfile.sql and tell it to replace the row in the event duplicate data is found?
Who is Participating?
UmeshConnect With a Mentor MySQL Principle Technical Support EngineerCommented:
I don't think you can do this while running command..

mysql dbname < dumpfile.sql

Instead while taking dump using mysqldump you can specify parameter --insert-ignore which take cares if any duplicate error thrown.

Or you can simply replace INSERT INTO with INSERT IGNORE INTO in the dump file

Some ppl might suggest to use REPLACE INTO instead of INSERT IGNORE but beware for InnoDB tables that might cause problems if its primary key is referenced somewhere...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.