Question

I'm uploading data to a db (mysql 5.1.42) from a dump file using mysql command line and get duplicate key error.

This is the format I use:

/mnt/temp# mysql -u username -p -h url_of_db_master -D farm2 < db_dump_part_file_a

Hoe can I tell mysql to ignore duplicate keys?

Thanks !

Was it helpful?

Solution

You'll have to decide what you want to happen when a duplicate is found, because you can:

Since mysqldump usually dumps each table in a single insert statement, you can easily just add those keywords in the dump file.

See this SO post for a more in-depth discussion on the pros and cons of the two possiblities.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top