Database synchronization between dev/staging and production

There may be a better way that I am missing but I am going to give you 2 options:

1.Use XML Export to export your new posts and comments. Then use the WordPress Importer to import the new posts and comments back into the dev database

It’s best to import into dev then move the database over to production because when you import it will download all the new media files from production.

In the meantime production has changed(new posts, new comments, etc.)

This would solve your problem of bringing in any changed content.

2. Use the INSERT IGNORE INTO MySql command to add the new tables from dev. or the REPLACE command to overwrite duplicate rows in the same table.

Before using MySql make a backup of both databases and move the gz database to the production server and upload the dump (change the name of dev if it’s the same as production.

INSERT IGNORE INTO `_wp_production_db`.`wp_cool_plugin_options`
SELECT *
FROM `_wp_dev_db`.`wp_cool_plugin_options`

I’m not comfortable with MySql commands so I would go with option 1.

Leave a Comment