Finally Moved from Berkeley DB to MySQL

UPDATE: I’ve posted the script below so others can download and use (or improve) it: mt-dbm-export.pl.

I’ve been quiet on the blog here for too long. Part of the reason has been that the database under the Movable Type 3.2 that powers the blog here has been partially corrupted.

The main reason was that for obscure reasons I was using Berkeley DB as the persistence layer, instead of something that makes MT happier, like MySQL. The presenting problem was that MT couldn’t see any comments, even though it was happily still accepting them, including spam comments.

This happened back in November, too, and back then I ended up writing a Perl script that opens the DBM files, grabs out the good stuff, and writes it out in Movable Type import format. (You’d think if my script can read the data then MT could too, but it’s more complicated than that, I guess. :-)

I dug that script out of the mothballs and ran it against the new database files. Posts and comments came out fine, but the trackback ping data was apparently messed up; it didn’t get all the pings, and they ended up associated with the wrong posts. So I ended up using the db from November, which got most of the pings.

Things I learned:
back up your MT settings
back up your MT templates
using CPanel to create the MySQL database
back up your new MySQL database, and continue to do so regularly
blog spam is not fun, but Eaton helps a lot
don’t run MT on Berkeley DB

Comments (5)

  1. Leighton Anderson wrote::

    Hi there, I’m sure this might seem a little strange, but I was tooling around with an old router of mine, a Linksys BEFSR41, and I was looking on google to get a copy of the latest firmware, and saw your post from like 2 years ago, about having problems with it when accessing .torrent files. I was curious if you were still using that router, and having the same problem. If so, feel free to give me an e-mail, I might have some steps to help you fix that problem.
    Or you can reach me on AOL Instant Messenger as “TheReverendLei”

    Wednesday, June 7, 2006 at 02:44 #
  2. may I use your script? how can I get it?

    tks in your advance

    Tuesday, June 27, 2006 at 12:00 #
  3. Hi, Rene! Thanks for asking — I’ve posted the script to http://peterkaminski.com/code/mt-dbm-export-pl.txt

    Sunday, July 2, 2006 at 08:25 #
  4. hi Peter

    correct me if I’m wrong, but the only thing I should edit is
    # Where to read your DBM files. For safety, these should be copies
    # of your live data, not the live database itself.

    my $db_dir = ‘.’;

    if so, should I put an absolute path such as “public_html/movable/db” or a url such as “http://www.usina.com/movable/db” ?

    tks in advance

    Friday, July 7, 2006 at 14:59 #
  5. hi Peter

    correct me if I’m wrong, but the only thing I should edit is
    # Where to read your DBM files. For safety, these should be copies
    # of your live data, not the live database itself.

    my $db_dir = ‘.’;

    if so, should I put an absolute path such as “public_html/movable/db” or a url such as “http://www.usina.com/movable/db” ?

    tks in advance

    Friday, July 7, 2006 at 15:04 #