Two weeks ago, I was working on my Friday Most Excellent article. I made a couple of tweaks to the article after it was published and pressed update. WordPress was busy saving for a very long time, then up popped the dreaded 500 server error message. No big deal I thought, I’ll just make the tweaks again and save it again. I pulled the post up and all but the first couple of sentences were gone!
My shock and dismay must have been a little louder than I thought, as my wife asked “What’s wrong?”. Shortly after, I remembered I had fortunately backups. I sure hope my BackupBuddy daily backup ran this morning …
Fortunately, my backup did run and I began the process of restoring my blog from backup to recover the article. In theory, restoring the backup should have just been a few simple clicks, but of course, it’s never that simple is it?
While the backup plugin I use, BackupBuddy (affiliate link), did make it relatively easy, I thought it would be helpful if I walked you through a complete restore of a BackupBuddy backup. If you aren’t familiar with BackupBuddy, it’s definitely a plugin I highly recommend and personally use on all of the sites. You can read more about how I use it for my blogs in my article: How to backup your WordPress blog automatically.
How to restore a BackupBuddy backup
The first step you’ll need to take is to download the backup that you want to restore. I keep both database and full site backups. This example will walk you through restoring a full site backup. Restoring a database only backup is very similar, just less steps. The instructions below will walk you through completing a BackupBuddy restore for my homeowners association website I’m working on.
I normally store all of my backups on Amazon S3, but for this example, I just ran a manual BackupBuddy backup and downloaded it straight from my Media Temple server. You can do this by going to the BackupBuddy >> Migrate, Restore menu option in your WordPress admin console. Once there, your screen should look similar to this one:
Preparing to restore the BackupBuddy backup
Since I did a manual backup and stored it locally, my latest backup was available right off the Migrate/Restore page. Let’s get the necessary files downloaded to our local computer:
- Right click on the link to your latest download listed in the Backup File section. Select Save As… and save the backup zip file. I generally just use the default downloads directory.
- Next, click on the red button that says ImportBuddy. You’ll be prompted for a password that will be associated with your importbuddy.php file. This password security mechanism keeps just anyone from accessing your importbuddy.php file. If you leave this field blank, the default password in your BackupBuddy settings will be used. I generally just input a unique password, just to be on the safe side.
- After entering a password or leaving it blank, the importbuddy.php file will be downloaded to your default downloads directory. Both your backup zip file and your importbuddy.php file should now both be in the same directory on your local computer.
Upload your importbuddy.php and backup ZIP file
Next, we’ll upload both files to your web server. There are a couple of ways to do this, with FTP being the easiest option. If you’re hosting company supports ControlPanel, you can also use ControlPanels file manager to upload both files.
Both of these files must be uploaded to the directory where your WordPress installation is located. This will be the same directory that contains the wp-config.php file along with the wp-contents directory and a number of other files and folders. If you are unsure of the WordPress installation location, contact your hosting company to confirm.
Also important: Do not rename the BackupBuddy backup file. The importbuddy.php file will not be able to find it if you do. Trust me, I learned the hardway.
Create a new WordPress database
Next we need to create a new database for the restore to be copied into. BackupBuddy will not overlay your existing database. Unfortunately this process varies by hosting company, and it would be to much for me to walk you through the process for even the top few. I could certainly help you as part of my services business or I’m sure your hosting company’s support would help you.
But in a nutshell, you’ll want to create a new database and a user for that database. The user you create should have full rights to the database. MediaTemple allows you to do this via Plesk, while companies like Bluehost and HostGator use ControlPanel.
Temporarily store the database name, database user name and database user password. We’ll be using that information shortly.
Restoring the BackupBuddy backup
Now that both files are in the proper location on your server, it’s time to restore the backup:
Open up your browser of choice, and navigate to your website, but put \importbuddy.php on the end. For example, if your blog is someblog.com, you would navigate to http://someblog.com/importbuddy.php
If you’re unlucky, like me, your screen now looks something like this:
Error #22434. This directory is not write enabled. Please verify write permissions to continue.
Don’t panic, easily fixed. Different hosts have different default levels of permissions. All BackupBuddy is trying to tell us here is that the directory for your WordPress installation isn’t writable. We’ll need to make it writable before we can proceed.
You can use your FTP program to do this or the ControlPanel File Manager. Find your WordPress directory, and change the file permissions for the directory that contains your WordPress installation to 777. Pay attention to what they were before you make the change, because we’ll need to set them back once we’re done. What 777 does is make your whole WordPress directory writable – not very secure. But don’t worry, we won’t leave it like this for long.
Here’s the screen shot from the FTP/Development tool I use show the correct permissions for the httpdocs folder on my MediaTemple server.
With that change made, access the importbuddy.php file from your web browser again. If all went well, you should see the screen for Authentication:
Remember earlier when we downloaded the importbuddy.php file and we either specified a password or left it blank for the default? Here’s where you’ll enter this password and press the Authenticate button. If you forgot the password, you can just get the importbuddy.php file again and re-upload it.
After pressing Authenticate, you’ll proceed to Step 1 – Choosing your backup file :
A couple things of note here:
- If you uploaded your backup zip file to the right place, you’ll see it listed above. If not, no worries. Click on the upload tab and you can select and upload it from here. If you use BackupBuddy Stash, you can select your file from there. I don’t currently use Stash as I started using Amazon S3 before they announced it.
- The little yellow warning is basically just telling us: “Hey, you already have a site installed here and bad things could happen if you just overlay it.” Now, if you’re confident an overlay won’t be an issue, than proceed. If you aren’t sure, you should delete all of the files and folders in your WordPress directory on your server so BackupBuddy can do a clean install. The couple of times I’ve done restores, I did an overlay with no issues, but your mileage may vary.
Once you’re ready, press Next Step and you’ll see the page below:
Really nothing to do here. This screen will show you the extract process for your backup ZIP file. Just watch for the “Files successfully extracted” and press the Next Step button. If you get an error, consult the BackupBuddy site, they have tons of FAQs to help you resolve any issues.
After pressing Next Step from the extract screen, you’ll see the following page:
This page is where you’ll tell BackupBuddy how to connect to your new database so it can import your data. Put your database information in and press the Test Database Settings button. Assuming you put all of your values in correctly, you should see the same text in gray above from my screenshot.
If so, press Next Step. If not, recheck/reenter the information and try again. The problem could also be that you may have wrote down the information incorrectly or made a typo when you created the database. If all else fails, just delete the database and create another one.
After pressing Next Step, you’ll see the following page:
This page is like the ZIP file extract page and shows the verbose output of your database import. If all goes well, you’ll see a message saying:
“Initial database import complete”.
If you get errors, use the error text to troubleshoot the issue or again consult the BackupBuddy site for assistance.
Assuming all went well, click Next Step!
This page wraps up the database migration by updating your WordPress config files and showing you the final import status. Hopefully yours says “Import complete” like mine.
At this point, you’ll want to access your site and verify it is operational. Do not close this window. – just open a new tab to verify your site.
Once you’ve confirmed that your site is up and running, press the Clean up & remove temporary files button and you’ll see this page:
This page displays a log of the clean-up activities. BackupBuddy is kind enough to clean-up any temporary files and backup files and removes the importbuddy.php file. I have seen this not work 100% of the time though, so I would definitely recommend giving your restored WordPress directory a quick skim and delete any unfamiliar BackupBuddy files.
Finally, don’t forget to reset your WordPress directory permissions back to the original value, which is generally 750. Resetting these permissions is critically important to securing your site, so please don’t forget!
BackupBuddy backup restore is complete
That’s it, all done. While certainly not 100% point and click, it is relatively simple, especially taking into consideration what’s going on under the covers. BackupBuddy does a lot of the leg work for you.
The really slick thing about BackupBuddy is that you can not only restore your site using it, but you can also migrate your site to another hosting company or server using the same process! I’ve also built “clean” template sites, with just WordPress, Thesis (affiliate link), and the base plugins I normally use. Then I ran a BackupBuddy backup and used the restore process to do new WordPress installs. This makes site creation and initial set-up really simple. This single feature alone has saved me a ton of time, and paid for the plugin 2-3 times over in time saved.
If you currently don’t use BackupBuddy, I would highly recommend you give BackupBuddy (affiliate link) a try. You won’t find me saying that about too many “pay for” products, but this is one that’s worth the money. The whole process just works, and the fact that I don’t even have to think about my backup process really helps me sleep better at night.
What’s this “affiliate link” thing? An affiliate link is a link that pays me a commission if you purchase the product in the link. The product doesn’t cost any more for you. I take affiliate offers very very seriously, and I don’t ever recommend a product or include an affiliate link to it if I haven’t personally used it and like it. Most of the time I use these same products everyday and when I don’t, I use them with my clients. You never have to worry about trusting an affiliate link on Side Income Blogging.