Convert background data from the Berkeley file DB to MySQL_MySQL

Source: Internet
Author: User
Tags db engines movable type
Transferring background data from the Berkeley file DB to MySQL recently decided to transfer the MT background data from the Berkeley file DB to MySQL.

One of the reasons is that relational databases can provide more flexibility, such as running an SQL statement to change a certain attribute of all entries. The other reason is to familiarize yourself with the database in advance, the dental website uses a virtual host. the database provided by DreamHost is MySQL. I used SQL Server, Oracle, DB2, and Postgresql to understand only one thing, mySQL has almost never been used.

The 5.0.27 installation file was downloaded and installed smoothly, using the first default port 3306, the database character set for the UTF-8.

After the installation is complete, run the command line client and enter help. there are not many help commands provided, and you have not seen the commands for database creation. you have checked the help file for installation, the organization is quite good and complete, and relevant commands will soon be found:

View the existing database show databases; connect to the database testuse test; create the database mtcreate database mt; next look for methods to convert existing DB to MySQL, and soon find a third-party tool mt-db-convert.cgi, the conversion between several databases supported by MT can be realized.

Download the package to the mt directory of cgi-bin and run it in the browser. enter the new MySQL database name mt, user name root, password, host name localhost, and start Convert. The conversion process was completed quickly. in less than 1 minute, no error message was prompted. the conversion information is as follows:

Mt-db-convert.cgi ($ Rev: 173 $): Converting your MT data between DB engines (for MT 3.2) Loading database schema... loading data... MT: Author. (1 objects saved .) MT: Blog .. (2 objects saved .) MT: Trackback ....................

(327 objects saved.) MT: Category ....................

(50 objects saved .) MT: Comment .. (2 objects saved .) MT: Entry ..............................

(514 objects saved .) MT: IPBanList (0 objects saved .) MT :: log ....................................... ........

(437 objects saved.) MT: Notification (0 objects saved.) MT: Permission ....

(4 objects saved .) MT :: placement ........................................

(527 objects saved .) MT :: template ......................................

(83 objects saved .) MT: TemplateMap .......... (10 objects saved .) MT: TBPing (0 objects saved .) MT: Session .............................

(29 objects saved .) MT: PluginData (0 objects saved .) MT: Config. (1 objects saved .) MT: FileInfo (0 objects saved .) done copying data from DBM to DBI: mysql! All went well. Your recommended setting -------------------------------------

# DataSource R:/SITE/mt-db ObjectDriver DBI: mysql Database mt DBUser root DBHost localhost DBPassword comein -------------------------------------

Then modify the mt-config.cgi file and change the data source to MySQL.

Accessing MT again seems to be normal, and even the original session is not lost, but the data used in the background has changed its location.

But found the Chinese garbled problem, Google to this method, modified according to the text, need to execute the mt-db-convert.cgi again, the data re-import MySQL, then access MT, garbled no, all Chinese characters are displayed normally.

After the conversion, we found a new problem. all the Tags in the original DB were lost because the mt-db-convert.cgi only supported MT 3.1, and other information may be lost due to data changes caused by the new features of 3.3.


This script is compatible with Movable Type version 3.1x. I didn't test it at any other versions.

In fact, MT itself has provided a conversion tool mt-db2sql.cgi, and mt. cgi in the same directory. The method is to install the MySQL database service, create a DB for MT, add the configuration information of the MySQL database to the mt-config.cgi, and retain the path configuration of the original Berkeley DB, that is, keep the configuration of the two databases take effect at the same time, and then run the mt-db2sql.cgi through the browser, the conversion starts automatically, displays the following information:

Loading database schema... Loading data... MT: Author 1MT: Blog 1 3MT: Trackback... Done copying data from Berkeley DB to your SQL database! All went well. after confirming the conversion is successful, modify the mt-config.cgi and comment out the configuration of Berkeley DB.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.