Blog on Photoblogs

The photographer’s resource for photoblogs

featured photographer

featured image

gallery promotion

Backing up a Pixelpost blog

November 22nd, 2008 by brett

Over the last while, I’ve noticed that quite a few folks are ending up here while looking for information on backing up their Pixelpost blog.  So I figured that I would create a quick write-up on a couple of different methods of backing up your pixelpost blog.

The first thing to remember is that backing up your pixelpost blog is a two-step process, first we need to backup the DB, and then we need to backup our templates, images, etc.

Backing up your MySQL database
There are a few methods of backing up your MySQL database, so pick whichever one works best for you.

Method 1: Command Line
This is my preferred method of backing up my pixelpost blog, I find it quick and easy, I probably should create a simple little PERL script to automate this.

First, we’re going to run mysqldump and create a text file of our database.   Here’s the syntax of the mysqldump command

mysqldump  -u <userid> -p <databasename> > <outputfile>

So for example, when I backup my database I run the command like so,

mysqldump –u btl –p btl > btl_backup.sql

When the command executes, I am left with a simple little text file which I could use to rebuild my pixelpost DB.

Method 2: Navicat
I love Navicat, if you haven’t used it before and find yourself working on databases all the time, then I would recommend checking it out!

If you decide to get Navicat you’re going to need to setup your connections before using the tool, but once you’ve done that backing up your MySQL database is super simple.

Double-click on whatever you called your connection (in my case localhost), and you’ll be connected to your database.

NOTE: I would suggest setting up Navicat to use an SSH tunnel in order to connect to your database host, this way your MySQL database doesn’t have to be listening for connections.  Just a quick security tip.

After you’ve logged in, select the database you would like to backup and simply click on the backup button.  In my case, I selected my blog database and then clicked on “Backup”.

Once you click on the Backup button the window will update and display any previous backups on the right-hand side of the window.  To create a new backup, just click “New Backup”.

A new backup window will appear and you’re able to set some other options, but if you just want a simple backup of the database, just click start.

When you click start you’ll see all lots of messages streaming by as Navicat backs up your database.  What you want to see is a “Finished – Successfully” message.

To find out where the backups are stored right-click on your connection and select “Connection Information” and look for the “Settings Save Path”.

NOTE: By default Navicat stores the backups in compressed form.  You can change this in the “Advanced” options tab before you execute the backup.

Method 3: PHP myAdmin
If your hosting company uses PHPMyAdmin this is probably the simplest method going to backup you pixelpost database.  Just login to PHPMyAdmin like you normally would, select the export tab, make sure that all the tables are highlighted and click “Go”.  Once the new screen loads, cut-and-paste all that information into a text file on your local computer.

Backing up all the files
So at this point we have the database successfully backed up, but we need to grab all our images and files to protect the rest of our installation.  Again, there are a bunch of methods to backup your files, but I will just talk about two.

Method 1: FTP
Super simple, grab your favourite FTP client (mine is FileZilla), login to your host, and download all the files to your local computer.  From there you can do whatever you would like with them, but I would suggest backing up onto some type of removable media (CD, DVD, USB key, etc)

Method 2: Command Line.
If you have command line access you could create a tar.gz file and simply download that.  Here’s how you would do it.

Here’s the syntax to create a tar.gz file,
tar czf - <path to files> | gzip > <filename>

So for example, if your blog was stored in /www/blog you could create a backup file this way,
tar czf - /www/blog | gzip > blog.tar.gz

NOTE: make sure that you don’t run the tar command while you’re in the directory you want to backup, you may get some strange errors!

2 Comments

Leave A Comment

2 responses so far ↓

  • 1 Bob Eddings Nov 26, 2008 at 10:13 am

    Thanks very much for this really helpful information. I was just getting ready to do this, so it couldn’t have come at a more opportune time. Thanks again!

  • 2 brett Nov 26, 2008 at 11:04 am

    @Bob: glad that it was timely!