Home Database Mysql Tutorial 将后台数据从Berkeley的文件DB转到MySQL_MySQL

将后台数据从Berkeley的文件DB转到MySQL_MySQL

Jun 01, 2016 pm 01:59 PM
relational database reason

最近决定把MT的后台数据从Berkeley的文件DB转到MySQL。

原因之一是使用关系数据库可以获得更多的灵活性,比如运行一条sql来变更 所有entry的某一个属性;另外一个原因是为了提前熟悉一下这个数据库,牙牙网站使用虚拟主机,DreamHost提供的数据库是MySQL,而我从前 主要使用了SQL Server,Oracle和DB2,Postgresql也只了解了一点,而MySQL则几乎没有接触过。

下载了5.0.27安装文件,安装顺利,使用了第一个默认端口3306,UTF-8的数据库字符集。

安装完成,运行了命令行客户端,输入help,给出的帮助命令不多,也没见到有关数据库创建的命令,便查了安装的帮助文件,组织的还算不错,很齐全,很快找到相关的命令:

查看已有数据库show databases;连接数据库 testuse test;创建数据库 mtcreate database mt;接下来寻找把已有DB转化到MySQL的方法,很快找到一个第三方的工具mt-db-convert.cgi ,可以实现MT支持的几种不同的DB之间的转换。

下载回来放到cgi-bin的mt目录,在浏览器访问运行,输入新创建的MySQL数据库名称mt,用户名root,密码,主机填入localhost,开始Convert。转换过程很快就完成了,不到1分钟,没有出现错误提示,转换信息如下:

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 -------------------------------------

然后修改mt-config.cgi文件,把数据源改成MySQL。

再次访问MT,看起来一切正常,甚至原有的session都没有丢掉,只是后台使用的数据已经改变了位置。

不过发现了中文乱码问题,Google到了这个方法 ,按文修改后,需要再次执行mt-db-convert.cgi,把数据重新导入MySQL,再访问MT,乱码没有了,所有中文显示正常。

转换后又发现了一个新的问题,原DB中的Tags全部丢失,原因是mt-db-convert.cgi仅支持到MT 3.1,3.3的新功能带来的数据变化可能还会有其它信息丢失。

NOTE

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

其实MT自身已经提供了转换工具mt-db2sql.cgi,与mt.cgi在同一目录当中。使用方法是,安装好MySQL数据库服务,并创建好用于MT的DB,将MySQL数据库的配置信息加入mt-config.cgi,并同时保留原Berkeley DB的路径配置,即保持两种DB的配置同时生效,然后通过浏览器运行mt-db2sql.cgi,转换会自动开始,显示如下信息:

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.确认转换成功后,再修改mt-config.cgi,注释掉Berkeley DB的配置即可

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is the reason why screencasting fails? 'A must-read for newbies: How to solve the problem of unsuccessful wireless screencasting connection' What is the reason why screencasting fails? 'A must-read for newbies: How to solve the problem of unsuccessful wireless screencasting connection' Feb 07, 2024 pm 05:03 PM

Why does wireless screencasting fail to connect? Some friends have reported that the connection fails when using wireless screen mirroring. What is going on? What should I do if the wireless screen mirroring connection fails? Please confirm whether your computer, TV and mobile phone are connected to the same WiFi network. Screen mirroring software requires devices to be on the same network to work properly, and Quick Screen Mirroring is no exception. Therefore, please quickly check your network settings. It is important to determine whether the screen mirroring function is supported. Smart TVs and mobile phones usually support DLNA or AirPlay functionality. If the screencast function is not supported, screencasting will not be possible. Confirm whether the device is connected correctly: There may be multiple devices under the same WiFi. Make sure you are connecting to the device you want to share the screen with. 4. Ensure that the network

What causes WPS Office to be unable to start a print job? What causes WPS Office to be unable to start a print job? Mar 20, 2024 am 09:52 AM

When connecting a printer to a local area network and starting a print job, some minor problems may occur. For example, the problem "wpsoffice cannot start the print job..." occasionally occurs, resulting in the inability to print out files, etc., delaying our work and study, and causing a bad impact. , let me tell you how to solve the problem that wpsoffice cannot start the print job? Of course, you can upgrade the software or upgrade the driver to solve the problem, but this will take you a long time. Below I will give you a solution that can be solved in minutes. First of all, I noticed that wpsoffice cannot start the print job, resulting in the inability to print. To solve this problem, we need to investigate one by one. Also, make sure the printer is powered on and connected. Generally, abnormal connection will cause

Comprehensive Guide to PHP 500 Errors: Causes, Diagnosis and Fixes Comprehensive Guide to PHP 500 Errors: Causes, Diagnosis and Fixes Mar 22, 2024 pm 12:45 PM

A Comprehensive Guide to PHP 500 Errors: Causes, Diagnosis, and Fixes During PHP development, we often encounter errors with HTTP status code 500. This error is usually called "500InternalServerError", which means that some unknown errors occurred while processing the request on the server side. In this article, we will explore the common causes of PHP500 errors, how to diagnose them, and how to fix them, and provide specific code examples for reference. Common causes of 1.500 errors 1.

Revealing the root causes of win11 blue screen Revealing the root causes of win11 blue screen Jan 04, 2024 pm 05:32 PM

I believe many friends have encountered the problem of system blue screen, but I don’t know what is the cause of win11 blue screen. In fact, there are many reasons for system blue screen, and we can investigate and solve them in order. Reasons for win11 blue screen: 1. Insufficient memory 1. It may occur when running too many software or the game consumes too much memory. 2. Especially now there is a memory overflow bug in win11, so it is very likely to be encountered. 3. At this time, you can try to set up virtual memory to solve the problem, but the best way is to upgrade the memory module. 2. CPU overclocking and overheating 1. The causes of CPU problems are actually similar to those of memory. 2. It usually occurs when using post-processing, modeling and other software, or when playing large-scale games. 3. If the CPU consumption is too high, a blue screen will appear.

Why is Apple mobile phone charging so slow? Why is Apple mobile phone charging so slow? Mar 08, 2024 pm 06:28 PM

Some users may encounter slow charging speeds when using Apple phones. There are many reasons for this problem. It may be caused by low power of the charging device, device failure, problems with the USB interface of the mobile phone, or even battery aging and other factors. Why does Apple mobile phone charge very slowly? Answer: charging equipment problem, mobile phone hardware problem, mobile phone system problem. 1. When users use charging equipment with relatively low power, the charging speed of the mobile phone will be very slow. 2. Using third-party inferior chargers or charging cables will also cause slow charging. 3. It is recommended that users use the official original charger, or replace it with a regular certified high-power charger. 4. There is a problem with the user’s mobile phone hardware. For example, the USB interface of the mobile phone cannot be contacted.

Reasons and analysis of win10 driver installation failure Reasons and analysis of win10 driver installation failure Jan 02, 2024 pm 04:57 PM

Some friends encountered the problem of installation failure when installing Windows 10 drivers, but they did not know the cause of the failure or how to solve it. There are several different reasons for this problem. Please follow me to find out below. Reasons why win10 driver installation fails: 1. System version Currently, Windows 10 system already has the function of automatically installing drivers. The introduction of this feature eliminates the need for users to manually search and install drivers when installing the system. The system will automatically detect and install appropriate drivers, providing a more convenient experience. If your driver installation fails, one solution is to try updating your system. This may fix some system-related issues, allowing the driver to

Troubleshooting the causes and solutions for HTTP status code 550 Troubleshooting the causes and solutions for HTTP status code 550 Feb 20, 2024 am 09:49 AM

Explore the causes and solutions of HTTP status code 550 Introduction: In network communications, HTTP status codes play an important role and are used to indicate the results of the server processing the request. Among them, HTTP status code 550 is a relatively rare status code that is usually related to the server refusing to execute the request. This article will explore the causes of HTTP status code 550 and provide solutions. 1. The basic concept of HTTP status code. Before understanding the HTTP status code 550, let us first briefly understand the basic concept of HTTP status code.

Why does win11 shut down automatically? Why does win11 shut down automatically? Jan 01, 2024 pm 11:39 PM

Recently, a friend encountered the problem of Win11 automatically shutting down after updating the system. In many cases, it happens when playing games. I don’t know what caused it. In fact, this may be caused by insufficient computer configuration or system failure. Let’s take a look at the causes and solutions. Why does win11 automatically shut down? 1. Insufficient configuration 1. Windows 11 system has higher CPU and memory requirements than Windows 10. 2. Especially when running large-scale games and other tasks, it is very easy to automatically shut down. 3. Users can try to restore the usage status before automatic shutdown by right-clicking the start menu icon and opening the "Task Manager" page. 4. Let’s check the CPU, memory, and disk on this page.

See all articles