Web Hosting

Backing Up Your WordPress Blog

Update 21 May 2012:

This article has been updated with a newer one covering WordPress backups in more detail. You can find the newer article here.

Original article starts here:

Here’s a question I saw today: can someone explain how to back up my WordPress blog?

Backing up your blog is an essential housekeeping task that you should do at least once a week.

If you’re a hyper blogger (2, 3 or more posts a day) then you’d probably want to back up your database each day, although you could probably leave your system files to be backed up on a weekly schedule.

So here’s how to back up your blog:    

The first thing to appreciate is that your blog is broadly split into two sets of files and they both need to be properly managed:

  1. Your WordPress files (or system files). These are the files that deliver the functionality of your blog
  2. Your Database files.  These are the files that contain your content – your posts and comments.

The database is where all your hard work has gone.  If you don’t have backups of your database and you lose it, you’ve lost all your work.  You’d have an empty blog.

The system files are easy enough to restore if they get corrupted: you can just install another copy of WordPress, adjust the database parameters in your config.php file and you’re all set.

Having said that, you’d still have to reconfigure all your settings, re-install your plugins, re-update them and so forth, so it’s going to be a pain.

But not the disaster that losing all your content would be.

I publish 2, sometimes 3 articles a week so I back up both my database and my system files once a week.

I also keep the original copies of the articles I publish so if I did lose those 2 or 3 articles I’d just have to re-post them – no big deal for 2 or 3 articles.

Back Up Your Database

OK – to take your database first:

There are a number of good plugins for managing your database. The one I use is WP-DBManager, but there are others.

The reason I like WP-DBManager is that, in addition to all the backup functionality that most of the database plugins offer, it also offers me the ability to repair, optimise and restore my database.

Optimising your database is one of the ways of keeping your blog running quickly, so in addition to backing up my database each week I also optimise it each week.

You can find WP-DBManager here.

So install WP-DBManager, activate it and then go to the ‘Database’ item in the menu on the left:

Click the second link, ‘Backup DB’ and the first thing it will do is run some checks to see if everything is configured correctly.

It will highlight any problems, which you may be able to fix in the ‘DB Options’ screen – there are some hints there to follow.

The problems are likely to be related to the paths to your database or backup folders, so if you can’t fix them from the DB Options screen you may have to ask your hosting provider for the answers.  They should be able to give them to you very quickly.

Once everything is set up you can just click the ‘backup database’ button at the bottom and in about 15 seconds you’ll be all done.

By default the back up file will be stored in the backup-db folder which will be inserted into the wp-content folder.

As a security precaution I always move this file from my server to my PC immediately after taking a back up.

If I need to restore my database in the future I just need to copy the latest version from my PC back to the backup-db folder and the plugin will do its thing.

Back Up Your System Files

Backing up your system files is just as simple but, unfortunately, can take up to an hour or more.  Still – you can set it running then go and have some breakfast, which is what I normally do.

To back up your system files you simply need to copy everything in your ‘wordpress’ folder, or ‘blog’ folder, or whichever folder you installed WordPress into, back to your PC.

This means firing up your FTP client, dragging your WordPress root folder and all its contents and dropping it into a back up folder on your PC.

This will retain all your settings and configurations, including your database parameters. If you then need to restore your system files for any reason (for example if a WordPress upgrade bombs out), you can just copy the ‘wordpress’ folder back to your server again.

As I said earlier – copying your system files back to your PC will take up to an hour or more, depending on your connection speed, your FTP client and so on. So set it running and go for a cup of coffee.

How Often and When Should I Back Up?

I back up everything once each week as a matter of course. I also back everything up before making any major changes to the site – e.g. upgrading WordPress.

A good principle to work off is that you can’t back up too often.

I while ago, before WordPress included auto upgrading in the core, I wrote a manual on how to upgrade WordPress manually.  Part of that also included how to back up and restore your database manually.

If you’d be interested in those database management steps let me know – I’ll happily give you a copy for free since the manual itself became obsolete when WordPress introduced auto upgrading.

OK – that’s it – hope it was helpful!

Web Hosting