mediatribe.net -- Drupal and Web Development

Notice: this post was last updated 3 years 44 weeks ago so it might be outdated. Please be cautious before implementing any of suggestions herein.

How to grab a local copy of a remote Wordpress database

(1) Log on to the remote server and visit wp-config.php, take note of the database, username and password.

(2) Make sure you have the same code locally (except wp-config.php, which is probably excluded from your version control repo), and run the following:

ssh me@example.com "mysqldump -uuser -ppassword databasename --default-character-set=utf8" > database.sql
echo 'create database localdb' | mysql -uroot -proot
mysql -uroot -proot localdb --default-character-set=utf8 < database.sql
cp wp-config-sample.php wp-config.php

Now edit wp-config.php and put your local database information in there.

I normally get a white screen if I try to access Wordpress in a domain that looks like http://localhost/wordpress, so you might need to set up your /etc/hosts and virtual hosts file to be able to access your wordpress site at a domain like http://wordpress.localhost/.

I loved your article

I loved your article post.Much thanks again. Fantastic. Shorette