Warning: include(/home/eliseb/public_html/includes/head.php): failed to open stream: No such file or directory in /var/www/www.learningmovabletype.com/archives/000587backing_up_your_blog.php on line 6 Warning: include(): Failed opening '/home/eliseb/public_html/includes/head.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/www.learningmovabletype.com/archives/000587backing_up_your_blog.php on line 6 Warning: include(/home/eliseb/public_html/includes/banner.php): failed to open stream: No such file or directory in /var/www/www.learningmovabletype.com/archives/000587backing_up_your_blog.php on line 9 Warning: include(): Failed opening '/home/eliseb/public_html/includes/banner.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/www.learningmovabletype.com/archives/000587backing_up_your_blog.php on line 9 Warning: include(/home/eliseb/public_html/includes/mainmenu.php): failed to open stream: No such file or directory in /var/www/www.learningmovabletype.com/archives/000587backing_up_your_blog.php on line 10 Warning: include(): Failed opening '/home/eliseb/public_html/includes/mainmenu.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/www.learningmovabletype.com/archives/000587backing_up_your_blog.php on line 10

« How to Make Money with Your Blog | Main | My Yahoo and RSS »

Backing Up Your Blog

Occassionally databases get corrupted, servers fail or web hosts go out of business. So it's a good idea to back up your Movable Type blogs. There are many methods for doing so, a few of which I will cover here. The back-up process is much easier if you are using MySQL as your database.

Backing up your MT blogs with MySQL

If you have chosen MySQL as your database for your MT install you can easily back-up the entire blog - entries, comments, authors, templates, etc. - with a simple MySQL "dump" command. The dump command will create a large "dump" file that will have all of the data from your database in it that can be used to easily restore all of your weblogs. To do this you need either command line access to your database or phpMyAdmin installed on your server. The instructions for the dump command and phpMyAdmin can be found in the MT 3.2 User Manual. You can also find instructions for the dump command at MySQL's website. All that said, phpMyAdmin is not installed on my server and I could not get the dump instructions to work. So I ended up needing some handholding from tech support from my web host. Tech support also set up a "cron job" for the server to automatically create a dump file, backing up all of my blogs every night. Every few days I FTP into my server and download the dump file to my desktop, so I have a local copy of the database.

Backing up your MT blogs if you use BerkeleyDB or MySQL

If you are using BerkeleyDB or if you are using MySQL and don't have phpMyAdmin and don't want to deal with Unix commands - the back-up process is a bit more involved. The three elements of your weblog installation that you want to back up are a) the entries with their comments, b) your index and archive templates, and c) your weblog configurations for each of the weblogs that you have on your MT installation. If you are using BerkeleyDB you can download a copy of the db file in binary mode but this won't be useful if you ultimately upload it to a server with a different version of BerkeleyDB.

1. Export your entries.

Using MT's export function you can export all of the entries for a particular blog, and their comments. In MT Weblog Edit, click "Import/Export" from the menu at the left. If you are on a Mac, hold down the "option" key or if you are on a PC hold the shift key. Next (while holding the option or shift) click the link, "Export Entries From yourBlogName" and you can save the export. The resulting file should be saved as a .txt file. If it shows up as "mt.cfg" don't worry - just change it to somethingmemorable.txt. Check the file and make sure the export worked and you have a text file with the data from all of your entries.

If you have multiple blogs on one MT installation, you can follow the above instructions for each weblog. Or you can create an Export Blog that will more easily automate the export process.

2. Back up your templates.

Using an FTP client, create a templates folder in the same directory of the index file of each of your blogs. In MT Weblog Edit, for each blog that you have, go to the manage templates section. Template by template, create a backup template by inserting a file name into the "Link this template to a file" window. For example, for your main index template, type in templates/mainindex.tmpl. Rebuild your files. This tip comes from MT forum moderator Girlie (Shelley) and can be found in detail at http://www.thegirliematters.com/tips/archives/0207/back_up_templates_with_link_this_template.php

You can also output your templates using MySQL and PHP.

3. Record your weblog config preferences.

For each weblog, click the "Weblog Config" button in the left-hand menu. For Core Setup, Preferences, Archiving and IP Banning, record your current settings by printing them out. Some printers don't fill out the check boxes when printing, so check your check boxes on your printouts for future reference.

Backing up your MySQL database
TypeMover - a plugin to help you backup, restore, and migrate your Movable Type weblog.
Creating Automatic Backups of your MT Database

Comments (8)

The MTWiki dump command isn't the best - if your MYSQL table gets too big it could start causing great strain on your server to dump and take even longer to download. A better dump command would be to tar gzip the file to do this add to the end of the MTWiki dump command with: | gzip -c > /path/to/backup/backup-mt.sql.gz

So the whole thing would look something similar to

mysqldump -h [name of the mysql server] -u [your username] -p[your password] [your database name]| gzip -c > /path/to/backup/backup-mt.sql.gz

The above will only work if your server supports it forgot to add sorry !


I recently found a wonderful script, Automatic MySQL Backup, that creates daily, weekly, and monthly backups in rotations. So you end up with no more than 7 daily, X weekly, Y monthly compressed backups. You can set X and Y. I run it nightly with cron and then another script backs up my backup directory to a separate server. Much piece of mind.

Julio Alonso:

I am about to both migrate from MT 2.61 to MT 3.11 AND change hosting. Now, what do you recommend that I do?

Option 1. Install MT 3.11 on the new host, export MySQL files from the old host, import them on the new host and cross my fingers...

Option 2. Upgrade MT 2.61 to MT 3.11 on the old host. Then use TypeMove to copy everything in the MT 3.11 installation on the new host. (Probably cross my fingers on this one as well).

My intuition says I should go for option 2, but I am a bit afraid (despite all the backups already done) of messing up with my original installation.

Besides, there's a couple of things I would like to change for the new installation, including naming convention for the individual archives.

Any/all opinions very much appreciated.


Julio - Personally I would go with option 1. Just don't turn off the old host until you have the new one running to your satisfaction. However, I am definitely NOT an expert in this. The best place to ask this question is at the MT Support Forums or through a support ticket. You will get better informed suggestions there.

Jim [TypeKey Profile Page]:

This will get my DB - but what about my static files - search templates, etc?

Thanks for everything you do

bill [TypeKey Profile Page]:

3. Record your weblog config preferences.

There is a FireFox plug-in called ScreenGrab that will capture the entire browser window and save it as an image. Save some trees and check out this tool.


I use this to quickly save a record of all my MT Config screen settings.

The perfect tool for your blog backup is SiteVault ( http://www.site-vault.com ). It takes a bit to configure but you can just forget about it until you need the latest backup restored ;).


Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Warning: include(/home/eliseb/public_html/includes/sidebar.php): failed to open stream: No such file or directory in /var/www/www.learningmovabletype.com/archives/000587backing_up_your_blog.php on line 305 Warning: include(): Failed opening '/home/eliseb/public_html/includes/sidebar.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/www.learningmovabletype.com/archives/000587backing_up_your_blog.php on line 305 Warning: include(/home/eliseb/public_html/includes/footer.php): failed to open stream: No such file or directory in /var/www/www.learningmovabletype.com/archives/000587backing_up_your_blog.php on line 306 Warning: include(): Failed opening '/home/eliseb/public_html/includes/footer.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/www.learningmovabletype.com/archives/000587backing_up_your_blog.php on line 306