• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 441
  • Last Modified:

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?
1 Solution
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...

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now