Mysql:Need to upload data to database, get duplicate key error - how can dup keys be ignored 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  &lt;
  db_dump_part_file_a


Hoe can I tell mysql to ignore duplicate keys?

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


ignore it (insert ignore ...)
do something (insert ... on duplicate key update)


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.