b2 to WordPress migration script

Update: There is a new version of the script (Version 1.1) that you should be using. Also, please note that this script is for the older b2 weblog engine not b2evolution.

* * *

I'm releasing the PHP script I wrote to migrate my b2 blog engine installation (version 0.6) to WordPress (version 2.0.2) in hopes that it might be useful to any other bloggers who are still stuck with their b2 installations for various reasons.

I decided to write my own script to carry out the migration as the latest WordPress release doesn't contain one and the only other alternative, apparently, would have been to go through a ridiculous series of upgrades (without any guarantees, as I had heavily hacked my b2 installation.) I wasn't interested in keeping my hacks (in fact, no more hacking -- from now on I can create lovely WordPress plugins if I want to add new functionality) but I did want to keep the list of users, posts, categories and comments.

So, without further ado, here's the b2 to WP migration script (b2towp.zip; 19kb).


Important: Make sure you have a backup of your b2 database. I recommend that you carry out this procedure on a development box first to make sure you're happy with the results.

  1. Use PHPMyAdmin to export your b2 database into an SQL file.
  2. Install WP 2.0.2
  3. On the machine you installed WP, use PHPMyAdmin to create a database for your b2 database and inport it from the SQL file you created in Step 1.
  4. Open the b2towp.php file in an editor and enter the database connection info for both the b2 and WP databases at the head of the file.
  5. Run the b2towp.php script
That should be it. Remember that this script migrates your users, posts, categories and comments only.

The script is released under CC-GNU GPL.