Backing up a WordPress Blog on GoDaddy


Blogging is a great way to prepare content for the Internet without spending a lot of time worrying about the details of website administration and content formatting. But it’s easier to put content in a blog than it is to get it out of the blog for backup purposes. WordPress has a way to export the postings and comments into an XML file for local storage, but since you have to remember to do it periodically, you’re likely to lose a few postings if something goes awry on the server and you haven’t done a backup for a while. And the XML export doesn’t save the images you may have uploaded to your web host because those are not stored in the same database as the posts and comments.

I started looking around for a WordPress backup solution and was unable to find anything that looked like a good fit. WordPress posts and comments are not located on your GoDaddy web host. They are on a separate host/database that GoDaddy sets up when you install WordPress as an application. I download my website’s changed files to my local PC using a scheduled WS-FTP session. I generally use FileZilla for FTP and would like to use it instead of WS-FTP, but it doesn’t have a way to automate periodic downloads so I’m forced to use WS-FTP for my backups. WS-FTP isn’t free, but until FileZilla supports recurring automated scheduling of uploads/downloads, it’s the only way I know to do this. The FTP backup takes care of downloading my blog images and other website files but not the actual blog postings or comments.

GoDaddy has a web interface to set up cron jobs and I was pretty sure I could back up my blog’s database to the same WordPress directory that stores my blog’s theme and php files using a script to dump the database. A database dump could put a copy of the postings and comments in SQL format in a location where my WS-FTP job could find it and download it on a regular basis.

I figured others would like to know how to do this, so I’ve written up a short ‘how to’ here.

I will assume you have are using GoDaddy’s Linux hosting and have an SSH login and know your way around a Linux system. If not, you’ll need some help from a Linux expert who can understand the instructions below.

First of all, you can use a single command to perform the WordPress database backup manually, to make sure it’s working. Here is an example of mine which I store in a file called “wpbackup” located in the wordpress directory (please note, this command should all be on a single line):

mysqldump --add-drop-table -h mysqlhostname -u mysqlusername -pmysqlpassword mysqldatabasename | gzip -c > $HOME/html/wordpress/yourblogbackup.sql.gz

If you can’t remember the mysql hostname, username, password, and databasename because GoDaddy generates them for you automatically when you install WordPress as an application, you can find them all in the /wordpress/wp-config.php file. Please note that there is no space between the -p and the password. All other spaces are required. The mysqldump command takes all the data from your wordpress blog database and puts it in a SQL format that allows you to re-import it should the need arise. The “| gzip -c” compresses the database since SQL is made of plain text and it compresses pretty well, probably 4:1 or better. If you don’t want to use it, you can leave it out.

You will need to confirm that this is working properly. Just make sure it’s executable and type in “./wpbackup” to run it. Then you can do a “gzip -d” on the yourblogbackup.sql.gz file to turn it back into sql statements so you can browse the contents of the output file. Once you’re sure it’s working, then you are ready to set up the cron job. It is possible set up a cron job manually by editing the crontab file in your home directory, but GoDaddy has a web interface that allows you to set up and manage cron jobs without having to know how to edit the crontab file directly. You can see the result in the crontab file by looking at it in your home directory after you set it up if you’re curious.

Just go to the Hosting Control Center -> Content -> Cron Manager

Set up the job to make the wpbackup script execute on a regular basis. It should be done frequently enough to insure that your FTP download is getting a recent backup of the database.

With the cron job executing on a regular basis, and a scheduled FTP download of your website, the most recent content from your blog will get backed up so that should misfortune strike, you’ll be able to restore it to its original condition. The two commands to do that are:

gzip -d yourblogbackup.sql.gz
mysql -h mysqlhostserver -u mysqlusername -pmysqlpassword mysqldatabasename < yourblogbackup.sql

(please note, the mysql command should be all on one line)

If you found a better or easier way to backup your WordPress blog, please leave a comment with a link to your solution.
WP Starter Guide

Converting from Blogger to WordPress


For some time, I’ve wanted to change the landing page of my website to my blog, since it was the only part of my website that was changing on a regular basis. I figured the best way to do that was to change over from the blogging tool I had been using for years (Google’s Blogger) to a more full-functioning solution that made adding content and customizations easier. After briefly considering a few Content Management Systems such as Joomla and Drupal, I ended up choosing WordPress. WordPress isn’t really a full content management system, but I’ve played around with WordPress before with an account on, which anyone can get for free. What attracted me to WordPress was that it installs the scripts and database locally and it is open source. Because it’s open source, it has attracted a number of developers who have written plug-ins for it. There are more than 4,000 WordPress plugins available. It also uses ‘widgets’ which allow you to customize the sidebar with things like a calendar, archive list, blogroll, and many other features. Blogger had the ability to do this too, but much of it required you to go in and edit the template, which was very painful and prone to error. And if you ever switched templates, you had to start over with your customizations. Because I host the blog on my own domain, Blogger also required me to completely regenerate every page whenever I made the slightest change to the template. That was taking longer and longer as my archive of postings grew.

WordPress uses PHP and MySQL to serve its pages. If I make a change to the template, it doesn’t need to regenerate any pages since they are generated on demand. I had hoped that by using WordPress’s pretty permalinks that all of my Blogger links could be preserved so as not to lose search engine traffic, but because I was moving the whole blog up a level in my domain and also because every page in a WordPress blog is essentially a php script, it didn’t work out that way. So I’m becoming skilled in adding ‘301 redirects’ for my more popular pages in .htaccess file to maintain my website’s search engine mojo.

Another big change I made last month was to switch hosting services. I had been running on a Windows IIS-based platform, something I chose about 8 years ago without thinking about it too much, to a Linux Apache-based platform that now allows me to have SSH login privileges. I think that once you have a website up and running, there is a natural reluctance to making major changes because you never know how much work it’s going to be to get all the pages and email addresses working again. Windows doesn’t care about capitalization in the URL so a file called ‘image.JPG’ and one named ‘image.jpg’ are the same file. Not so with a Linux system. This can lead to a lot of broken links if you were sloppy when you created the original links. I also had a number of sites I help host as a ‘re-seller’ under my previous web host plan and I took the opportunity to combine them all into subdomains that are under on my upper-level domain. This makes them easier to manage and cheaper for everyone.

I started taking two classes at the local college in January on web technologies that I knew about, but felt I had only a superficial understanding of them. It’s pretty easy to learn HTML through osmosis, by using the ‘view source’ feature and by referring to a manual. But the technologies that run the web now, namely CSS, Javascript, PHP, and content databases have completely changed how the web works. You really have to understand a lot more to put together a website these days and you can’t do it by making static HTML pages. So I’m going through the rigor of taking these classes, doing the assignments and projects, and having many ‘a ha!’ moments where something that was confusing suddenly makes sense. I’ve also found myself in the role of tutor to the others in the class. I welcome that opportunity because the best way to really learn a subject is to attempt to teach it. Sometimes I feel a little like the blind leading the blind, but I am learning the material better as a result of tutoring others.

I had used the now-abandoned Microsoft FrontPage to generate my static web pages previously, something that always gets an audible groan from any self-respecting web developer, but now I’ve begun using Dreamweaver instead. However, in one of the classes where we use Linux exclusively, I’ve switched to just using gedit and Firefox as my sole web development tools. I had tried this a long time ago with Notepad and Internet Explorer, but it was painful to do because Notepad doesn’t color code the text to help alert you to formatting errors, which are very easy to make in HTML and CSS files. But gedit on Linux (or Notepad++ on Windows) have almost made the WYSIWYG web editor obsolete. With Firefox plugins like Firebug to help debug CSS and Javascript, you can do web development without costly tools like Dreamweaver, which only seems to get in the way when pages depend on Javascript and CSS to render properly.

If you’re interested in changing over from Blogger to WordPress, drop me an email and I’m sure I can help now that I’ve just done it. I had thought it would be as simple as an XML export/import, but it turned out to be much more complicated, requiring multiple steps along with an account on to talk directly to an account on in order to get the content to import properly.