Restoring WordPress from a backup to Dropbox using cPanel and phpMyAdmin

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.


Image 1: Dragging and dropping all my blog files into ‘blogtemp’ using the cPanel File Manager v3

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.


Image 2: Selecting all my WordPress files and zipping them up on Max OSX

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.


Image 3: Extracting my zipped archive after uploading it using cPanel File Manager v3

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.


Image 4: My backed up WordPress files are now in my blogs root directory

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.


Image 5: Clicking phpMyAdmin within a list of database tools in cPanel

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.


Image 7: Clicking ‘mikeydc_wrdp1′, the WordPress database I intend to replace with my 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’.


Image 8: Renaming the database to ‘mikeydc_wrdp_old’ within the operations tab and being presented with the confirmation prompt

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.


Image 9: Selecting my backed database SQL file within the phpMyAdmin import tab

Now that you have located your SQL file all you need to do is click ‘go’ and your backed up database will be restored.


Image 10: A successful import

Thats it!

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.

 

 


Tags:
Post Details