DatabaseThe upgrade marks the development of the database. It indicates that the database has more powerful functionality and is more advanced in technology. It is not free to upgrade the database. Generally, database upgrades will generateGarbledThis article will explain how to solve the Garbled text problem. This article usesMysql3UpgradeMysql5For example.
My original database version is 3.23. A few days ago, this was due to a forum transfer. the value 5.1 must be used. the database is upgraded. the Forum is normal. it can be an old database because it is under 3.23. gb2312. no matter how it is imported to the new database, it is garbled. later, I searched for various materials. I borrowed a post from discuz. the upgrade is successful. I will summarize my experiences.
Environment:
1. The old database is mysql 3.23, the new database is mysql-5.1.33-win32.msi. The database name is www.cxinbao.com
2. My local computer is xp sp2
First install the 3.23 database locally. directly package the database on the server in the data directory to the local device. copy to the data directory where the local database is located. the same version. or. for versions earlier than 4.1, copy the directory directly. versions earlier than 4.1 must be transferred to 4.1 or later. you cannot copy the file directly. the character set is involved. it can be exported only from mysqldump. import again.
1. Install 3.23. Run cmd to enter the bin directory of the database. Then run the export database as an SQL file.
Mysqldump-uroot-p -- default-character-set = gbk www.cxinbao.com> cxinbao. SQL
2. Delete the table in the original database. Run the SQL statement and import the exported SQL statement to the database.
Mysql-uroot-p -- default-character-set = latin1-f www.cxinbao.com <cxinbao. SQL
3. Export the database you just imported as SQL,
Mysqldump-uroot-p -- default-character-set = latin1 www.cxinbao.com> cxinbao. SQL
4. stop mysql Server 3.23 in the service. then install the mysql5.1 database ., use UTF-8 to encode the cxinbao in the bin directory of MySQL database. copy SQL to the bin directory of mysql5.1 database. run cmd to go to the bin directory where mysql5 is located. run
Mysql-uroot-p -- default-character-set = gbk-f cxinbaonew <cxinbao. SQL
In this way, the cxinbaonew database is the database you transferred successfully. This database must be created in advance.
This is what I have summarized for you to solve the Garbled text problem. I hope it will help you.