So you have logged onto you blog recently and some pesky haxor has defaced it and spammed your comments! That or your host has sent you an email stating that the hard drive your blog was on has crashed and you have they have no backups!
What do you do? Luckily you have backed up your blog using WordPress Backup to Dropbox on a regular basis so you can easily restore you blog back to its finest form in a few steps.
This tutorial uses cPanel and phpMyAdmin that are very common for most hosting providers. If you do not have cPanel or phpMyAdmin similar steps should work with other site configuration and management tools and database managers, you will just need to dig around to find the right actions.
On my server I access cPanel via the ‘/cpanel’ route eg ‘http://www.mikeyd.com.au/cpanel’ if this is not the same for you contact your host to find out how to access it.
Step 1: Move your current WordPress installation to a temporary folder
You site is now borked so its files are corrupt its best to get the current installation out the way so you can revert it to your backed up version. Of course you can skip this step if you have no current WordPress installation or its only your database that is corrupt.
The best way to do this is using your favorite FTP client or web based file manager create a new folder called ‘tempblog’ or something similar and mover the contents of your blogs root directory into it.
At this you may wish to upload a simple file named ‘index.html’ with some text explaining that your site is down for maintenance. A file named ‘index.html’ is usually served by Apache before any PHP files so make sure you delete it when you have finished restoring your blog.
Step 2: Upload you backed up files
Now you are ready to upload your backed up files to your server. If you have the Drobox client installed on your computer your backup will be within your defined folder, if not you will need to download them from Dropbox manually.
I am using cPanel File Manager v3 to do this but it can be done using your favorite FTP client or another web based file manager. Firstly you will need to create a zip archive of your WordPress backup and upload it to your server.
Note: If you are using an FTP client you dont need to make a zip. Instead upload the files directly to your server.
Now find the newly uploaded file and extract the contents of the zip archive into your blogs root directory, again this can be skipped if you are using a FTP client.
We no have our backed up blog files back on our server! But its not over yet. Now we need to restore our backed up database.
Step 3: Rename your current WordPress database
Most hosts these days ship with a nifty tool know has phpMyAdmin that can be accessed within cPanel under databases.
Once phpMyAdmin has been loaded and you have a current WordPress installation that you wish to overwrite you will need to first re-name it so you can restore your backed up version. This can be done by selecting the databases tab and then choosing the WordPress database you intend to replace with your backed up version.
Now that your database has been selected you will need to rename it within the Operations tab by choosing a new name for it, clicking ‘go’ and then clicking ‘ok’.
Step 4: Restore your blogs database using phpMyAdmin
Now that the old database is out the way you can use the phpMyAdmin import tool to import your backed up SQL file. To do so you will need to go to the phpMyAdmin home menu by clicking the little house on the left hand side. Once here click on the Import tab, click the ‘choose file’ button and locate your SQL backup.
Now that you have located your SQL file all you need to do is click ‘go’ and your backed up database will be restored.
Step 5: Verifying and cleaning up
If you created the ‘index.html’ maintenance page, you can delete this now and verify that your site is back to its former glory. Once you are happy that its back you can delete the old database and the temp folder containing all the old WordPress.
Remember your milage may vary because everyones servers and setups are different. If you have any issues, feel free to ask a question in the comments below.