mediatribe.net -- Drupal and Web Development

Notice: this post was last updated 3 years 32 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

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <h3>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.