How to backup your WordPress site to Amazon S3 using BackWPup backup plugin (Part 5 of 5)

by StressLessWeb on February 26, 2012

in Technical

This article series will give you step-by-step instructions for formulating and implementing your backup strategy:

Part 1) Introduction
Part 2) How to install BackWPup WordPress backup plugin
Part 3) How to sign-up for Amazon S3 to store your backup files offsite
Part 4) How to configure BackWPup to store your wordpress website backups on Amazon S3
Part 5) How to restore your website from your backups

In the previous articles in this series we installed the BackWPup plugin, created a job for doing manual backups and signed up for an amazon S3 account, created and stored backups on Amazon S3.

This is Part 5 of 5 in the series. It provides instructions for restoring your website from a backup.

Determine whether to restore the entire site

So you have done all the hard work of setting up a backup plugin. And you have ensured that your site gets backed up on a regular schedule.

And unfortunately something has gone wrong with your website that requires a recovery from the the backup.

First, determine the extent of the damage:

- Do you need to restore the database?
- Do you need to restore the WordPress files?
- Or do you need to restore both?

Perhaps you are not sure which files need to be restored. Or you may not know whether the database is completely hosed, or simply missing a few rows.

In this article I will show you how to completely restore your website assuming you have been doing a complete backup which includes all the WordPress files.

First, do another manual backup of the website and keep it just in case you need some files or data from it.

After this you are ready to wipe your website clean.

If you are not confident enough to restore the site yourself and need an expert to restore your site, contact us and we will be happy to work with you.

Starting with a clean slate

If you want to start with a clean slate and restore the entire site to the state it was in at the time of the last backup then you will need to delete all the WordPress files and delete all the data from your WordPress data.

Before you proceed any further: Be sure you are confident in your ability to deal with any unforeseen issues in case something goes wrong. Before you delete files open the backup zipfile and ensure it contains a full backup of your site. The following instructions assume that you have a FULL BACKUP of your site including a backup of the WordPress files and a backup of the database.

Ok, if you are sure about proceeding then lets begin.

Step 2) Delete all the data from your wordpress database:

Most cPanels provide phpMyAdmin for database administration. Using phpMyAdmin, drop all the wordpress database tables that are used by the site.

If the database is used by multiple websites make sure to delete only the database tables used by the site that you want to restore.

Deleting WordPress files

Deleting_WordPress_files.png

Using your FTP client or your Hosting Provider’s cPanel, delete all the files under your website’s root folder. Usually the root folder is called public_html or www. Delete all the files and folders under this folder.

In the screenshot above, the WordPress installation is under /public_html/testbackup. Most WordPress sites are installed directly under public_html.

Drop WordPress database tables

Drop_WordPress_database_tables.png

Most hosting providers will provide phpMyAdminor similar interface for database administration. Using phpMyAdmin, drop all the wordpress database tables that are used by the site.
If the database is used by multiple websites make sure to delete only the database tables used by the site that you want to restore.

1) Choose the correct database
2) Select all the tables. If the database is used by multiple websites make sure to delete only the database tables used by the site that you want to restore.
3) Choose the "Drop" action. This deletes the selected tables from the database.

Restore the files

1) Copy the backup zipfile to your wordpress root folder (usually public_html).
2) Unzip the zipfile.

Your files are now restored! Really.

Restore the database

Restore_the_database.png

The backup file contains a called <database_name>.sql – where <database_name> is the name of your database. This file contains all the necessary instructions to retore your database to its last known state.

In order to insert this data into your database download and copy the restore script from this zip file (http://api.backwpup.com/download/backwpup_db_restore.zip) to your website’s root folder. This zipfile contains backwpup_db_restore.php. Now this file (backwpup_db_restore.php) should be alongside wp-config.php and wp-content folder under your root folder.

Now visit this URL from the browser: http://your.website.com/backwpup_db_restore.php and follow the prompts

media_1330215751067.png

All the necessary fields will automatically get filled. You don’t have to add or change any data.

The Restore script alows you to change the URL of your site. Note: This means that you can use this process to change the URL of your site – not just for restoring a broken site!

Click the Restore button

media_1330216028178.png

The script will show a confirmation screen as show above.

Now you’re website is restored!!!

But you are not yet done. There is one very important step left.

Delete the restore script and SQL file

Delete_the_restore_script_and_SQL_file.png

Using your FTP program (FileZilla shown above) or your hosting provider’s cPanel, delete the backup SQL file and the restore script.

This is extremely important. If you keep these files around an unautorized person can invoke the restore script or even learn the database name and password and hack into your website!

Thats it!

Your website is restored to the state of the last backup!

And this concludes this 5-part series on WordPress Backups.

What are your backup strategies? What are your lessons learned? Do you have any stories about how a timely backup saved your site and your sanity? Let us known in the comments below.

  • Facebook
  • Twitter
  • Pinterest
  • Google
  • Email

{ 0 comments… add one now }

Leave a Comment

Previous post:

Next post: