Import some database entries through PHPMyAdmin with overwrite

A great option is to handle this on your initial export from phpMyAdmin locally. When exporting from phpMyAdmin:

  1. Export method: Custom
  2. Format: SQL
  3. Format-specific options - choose "data" (instead of "structure" or "structure and data")
  4. In Data creation options - Function to use when dumping data: Switch "Insert" to "Update" <-- This is the ticket!
  5. Click Go!

Import into your production database. (always backup your production database before hand just in case)

I know this is an old post, but it actually helped me find a solution built into phpMyAdmin. Hope it helps someone else!


This is a quick and dirty way to do it. Others may have a better solution:

It sounds like you're trying to run INSERT queries, and phpMyAdmin is telling you they already exist. If you use UPDATE queries, you could update the info.

I would copy the queries you have there, into a text editor, preferably one that can handle find and replace, like Notepad++ or Gedit, and then replace some code to change the queries around from INSERT to UPDATE.

See: http://dev.mysql.com/doc/refman/5.0/en/update.html

OR, you could just delete them, then run your INSERT queries.

You might be able to use some logic with find and replace to make a DELETE query that gets rid of them first.

http://dev.mysql.com/doc/refman/5.0/en/delete.html


Check out insert on duplicate. You can either add the syntax to your entries stored locally, or import into a temporary database, then run an INSERT ... SELECT ... ON DUPLICATE KEY UPDATE. If you could post a schema, it would help us guide you better.