Nov 6, 2014 - General Web Development, Wordpress    Comments Off on Update a test WordPress database with your live database

Update a test WordPress database with your live database

It’s a good idea to use a test WordPress site for trying our new features, plug-ins, etc. It should look as much as possible like your live site. However, from time to time, it may become a little stale. Here’s how to update the test database with your live one.

Actually, we’re going to replace it, rather than update it…

  • Using phpMyAdmin, take a backup of each database (use the Export SQL file feature)
  • In the test database, use phpMyAdmin to select all of the tables, and then perform a Drop function on them, leaving the empty database intact
  • In the test database, use phpMyAdmin to Import the SQL file of the live database
  • Once you have the database imported, you now need to update 2 records in it. These are the URLs for the WordPress site, and they’re located in the wp_options table
  • In the option_name column, look for a field called siteurl. You should see the live web site’s URL here. Edit it to change it to the test web site’s URL.
  • Do the same thing for the field called home

That’s it! You should now have matching web sites for your test and live environments.