Migrating a Wordpress database from a production server to a test server

From Stack Overflow
Jump to: navigation, search
  • scp/tftp/ftp/whatever to copy files to your test server
  • standard mysqldump of live server and mysql client load of test server
  • Update the database with correct URL, substituting username, password, test URL, and database name:
mysql -uroot -e "update wp_options set option_value='http://test.netninja.com' where option_name='siteurl' or option_name='home'" netninjablog
  • Force wp-cache to be disabled (assuming you are running the wp-cache plugin):
sed -i.bak 's/^$cache_enabled = .*/$cache_enabled = false;/' wp-content/wp-cache-config.php