August 15, 2004
MySQL or Berkeley DB?
When installing Movable Type for the first time, you have a choice of what database to use - MySQL, PostgreSQL, SQLite, or the default - Berkeley DB. The recommended choice is MySQL for many reasons. MySQL is more stable, more powerful, more easily editable than Berkeley DB. With one simple command you can back-up your entire MySQL database (See Backing Up Your Blog). Many web hosts offer a cPanel or phpMyAdmin utility to manage your database, making it easy to make global changes to your weblog.
If you are using Berkeley DB and you change servers, or your host upgrades your server (this has happened to me twice in the last year), the version of Berkeley DB must be exactly the same on the new server than was on the old or your database won't work and you will not be able to access the MT edit window.
The default database that comes with Movable Type 3.15 and earlier versions is Berkeley DB. Many people end up using Berkeley because, even though they have access to a MySQL database, the installation instructions for BDB are just a little less confusing than for MySQL. This is a mistake. If your web host offers MySQL, by all means use it. If your web host doesn't offer MySQL, you should change web hosts and find one that does. Trying to trouble-shoot MT when the Berkeley DB has become corrupted is simply not worth the pain. From what I understand, in the future the default database for MT will be some version of SQL, not BerkeleyDB.
Upgrading from Berkeley DB to MySQL
If you are already using Berkeley DB on an MT installation, you can switch your database to MySQL by following the instructions posted on the MT Manual forConverting your Berkeley DB database to a SQL database. You will need access to an upgrade script file named mt-db2sql.cgi which you can find in an upgrade version of Movable Type. For example, if you have downloaded and installed the full version of MT2.661, you will need to download the upgrade version of MT2.661 to find the above script. Make sure you use the script associated with the version of MT that you are running.
Installing MT with MySQL
The Configuration section of the MT Install Guide lays out the steps for setting up your MySQL database. The instructions are a little obtuse, so I'll try to simplify.
1. Confirm that your host supports MySQL.
2. Find out from your host the following information:
---a. The name of the MySQL database
---b. The user name connected to the database
---c. The password for the database
3. Add the following lines to your mt.cfg file using a text editor like BBEdit:
Substitute "database_name" with the name of your database.
Substitute "database_user" with the user name for your database.
Here's an example of what this could look like:
Note the additions to these lines if your MySQL database server is on a different host, in a non-standard location, or is on a different port than the default. Your webhost should be able to help you determine the host name, path, and/or port number in this case.
4. Set your password for the MySQL database in the mt-db-pass.cgi file.
Open mt-db-pass.cgi in a text editor. Change the line "database_password" to the password of your database. Save the file.
Please direct ALL questions regarding installation of Movable Type or your particular database troubleshooting to the MT Support Forums. There is an entire section of the forums devoted to database issues. I will leave comments open here for those who want to add to, correct, or clarify something in this tutorial. Other comments may get deleted.Technorati Tags: Has this tutorial been helpful? Please consider linking to Learning Movable Type at http://www.learningmovabletype.com/ . Thanks!