MySQL Backup and Restore

I was having a time moving my blog from one database server to a newer one at my hosting company that had more space and was reportedly faster.  After banging around for a bit I found it was most easily accomplished from the command line using only two commands.  These technique requires access to your web host via SSH, and some knowledge of the *Nix command line.

To Backup:

mysqldump – – databasename -p > filetocreate.sql

You will be prompted for the password which you can enter. The file will be output into the folder you are currently in.  After this completes you can upload the file to your new database host with the following command:

To Restore

mysql – – -p databasename < fileyoucreated.sql

Again you will be prompted for the password which you can enter and the database will be streamed to it’s new location.  Once that is done backup wp-config.php and then pop into your wp-config.php and update the database name, username, database host name  and password.  Cross your fingers and open the site back up to see the results, your mileage may vary. Drop me a message if this doesn’t work for you.

This entry was posted in Ramblings. Bookmark the permalink.

Comments are closed.