The Super Easy Guide on how to Back Up WordPress

 

If you’re a frequent blogger/writer you’ll know how valuable in terms of time and effort your articles are, especially if you’re writing isn’t earning you a living. What protection do you have though for your long coffee drinking sessions of inspiration?

Well, you have this somewhat illusive process called backing up. Unfortunately this relatively pain-free process is often overlooked. In this article I’ll show you how you can keep piece of mind by backing up your WordPress (WP) blog – saving you days and hours of torment when that horrible day comes and your site gets erased from the face of the WWW (this can also be applied to many other blogging systems and database driven sites so don’t run away just yet if you’re not using WordPress).

What’s going to get backed up
  • The WordPress database
  • A WordPress XML file (details on this later)
  • Remote WordPress Core files
  • Local WordPress Core files
Set up a folder structure

You need to be organised on your local machine before we do anything. Dedicate a backup folder for each of your websites and create folders inside this that indicate the date and type of backup. By type, I mean local or remote backups. I’d advise remote and local copies just incase there any differences in the WP installation. This may include any updates to plugins or similar updates done with your browser.

First, backup your database

Right, I’m going to say it, brace yourselves, SQL. Yes, the best type of backup you can possibly do is to export your WordPress database to an SQL file.

Depending on your hosting company, you should have access to cPanel or phpMyAdmin at the least, so we’ll use phpMyAdmin for this. Open phpMyAdmin and select Export from the top menu.

You should now see the Export options. First, choose the database you want to export, in my case ‘nouvelle_worpdress’. Next, select the export file type, choose SQL. Make sure you tick the ‘Save as file’ option and choose either ‘zipped’ or ‘gzipped’. Then hit go!

You should now be downloading a zipped up SQL file. Once downloaded, place it in your remote backup folder for the current day. That’s your entire WP database backed up, simples?

XML time

WP has an in-built tool for exporting your posts, pages, comments, custom fields, categories, and tags. Though you shouldn’t rely on this method as your main backup, it’s still best to get your XML fix. Log into your WP admin area and select ‘Tools’, then ‘Export’.

All you need to do now is to select which authors you want to export (I recommend exporting all the authors each time) and hit ‘Download Export File’. This will give you an XML file which you should place in the same folder as the SQL file.

WordPress’s core files

You should have an up-to-date copy of your entire site (WP installation) on your local machine, cut this from the current folder and place it into the local backup folder for the current day. Now re-download from your FTP server what you just cut from your local files and copy it into your remote backup folder for the current day.

You should now have a local copy of your of:

  • Remote SQL file
  • Remote XML file
  • Remote WP Core files
  • Local WP Core files

Once you have all these files you should then backup your information to an external HDD or use a system similar to Time Machine. Your backup should now be complete!

How often should I back up?

Well, this purely depends on how much and how often your write. Usually a week’s backup will suffice but if you do any larger changes then a backup on that day wouldn’t go a miss.

Programs like Time Machine will help to keep your local backups up-to-date by the hour if needed but remember, you’ll still have to monitor your remote backups too.

Automation? Cron jobs, at your service

If you don’t want to keep going into phpMyAdmin to export your database to SQL every time you can use something called a ‘Cron Job’ to do the hard work for you. Cron jobs are simply pieces of scripts that are executed by your server at a given time. These are normally handled in the cPanel (or similar) interface (You can find them under ‘Advanced Tools’).

There are many ways you can configure each job so I’ll just show one method for now. Go into the ‘Cron Job’s section and choose ‘Advanced (Unix Style)’ and paste in the below code into the ‘Command Line’. This will export your database to an SQL file in the specified directory, make sure you’ve replaced the capital letters in the code with your information.

You will also need to specify a date for this function to occur. In this case I’ve used 1 1 * * 1 which will export my database on the first minute, of the first hour on the first day of each week. Then I simply download it from my FTP.

mysqldump -uUSER_NAME -pPASSWORD DATABASE_NAME > /home/username/www/path_to_backup/localhost.sql

Conclusion

I hope you found some of the processes helpful to backup your blogs and if you have any questions please leave a comment. If you have any backup methods of your own, let us know!

Become expert in wordpress with testking SSCP web designing course. We offer best quality testking XK0-002 resources with thousands of free testking HP2-T16 graphic tutorials for practice and review.

Tags: , , ,

About Callum Chapman

Callum Chapman is a UI designer. Follow him on Twitter and Dribbble.

7 Responses to “The Super Easy Guide on how to Back Up WordPress”

  1. Rob Cubbon January 26, 2010 at 10:10 am #

    Excellent synopsis of backing up WordPress. I’ll have to look in to Cron Jobs. I have cPanel and PHPMyAdmin on my host and I have screen shot of the export panel handy every time I export the database to check if all the ticks are in the right place!

  2. Sally Strebel January 26, 2010 at 11:00 pm #

    Great tutorial on how to back up WordPress. It’s always a good idea to back up work. Our company page.ly does nightly backups of all sites for extra assurance and auto updates the core of WordPress. I’d love to have you take a look at it.

    All the best,
    Sally

  3. Ted Rex January 27, 2010 at 2:50 pm #

    Great tutorial about a topic I had not really thought of too much.

    I made this one of my three links of the day on my Design Thought blog:
    http://designthoughtfortheday.blogspot.com/2010/01/01-27-better-fbook-fans-back-up.html

    Thanks for tips, Ted

  4. jeprie February 3, 2010 at 11:32 pm #

    i use plugin wp-db-backup to automate backing up my db and send it to email. you can find it at http://www.ilfilosofo.com/blog/wp-db-backup

  5. Omer Greenwald February 27, 2010 at 10:48 pm #

    I didn’t use the cron jobs up until now.
    Backing up your blog can also be really useful for creating a local test duplicate for your blog as explained here http://www.webtechwise.com/how-to-backup-your-wordpress-blog-and-install-it-locally-using-xampp/

    Useful article, thanks

  6. Jeff March 21, 2010 at 4:06 am #

    I’ve tried some cron jobs, i’m always in fear they will overload the server or run in an infinite loop.

    Easiest for me is to go into phpmyadmin and just save the database to my drive. Still a pain though.

  7. cosplay July 21, 2010 at 10:10 am #

    A great promo idea worth borrowing.

Leave a Reply