Merging one SQL database into another Currently in my CI I'm completely wiping production db with development db. That was fine for testing but I'm coming to a stage where I need to start merging instead of completely wiping.
Right now the command I'm using to wipe and write is as follows:
mysqldump -u &quot;$DB_USERNAME&quot; -p&quot;$DB_PASSWORD&quot; -h &quot;$DB_HOST&quot; &quot;development&quot; &gt; dump.sql
mysql -u &quot;$DB_USERNAME&quot; -p&quot;$DB_PASSWORD&quot; -h &quot;$DB_HOST&quot; &quot;production&quot; &lt; dump.sql

I tried the following for merging:
mysqldump --no-create-db --no-create-info -u &quot;$DB_USERNAME&quot; -p&quot;$DB_PASSWORD&quot; -h &quot;$DB_HOST&quot; &quot;development&quot; &gt; dump.sql

Which I thought would do the trick but I get the following error:
ERROR 1062 (23000) at line 23: Duplicate entry '1' for key 'PRIMARY'

Any ideas where I'm falling short?
Adding this to the mysqldump will probably work:
 --insert-ignore

The error message implies that you already have a row with primary key id=1 and are trying to add it again.
Caveat:  If you have modified that row, this technique will not achieve the &quot;merge&quot; goal.  Please specify the &quot;merge&quot; more thoroughly.