MySQL 4, MySQL 4.1, MySQL database Chinese problems

Source: Internet
Author: User

MySQL 4 database, if you want to migrate to MySQL 4.1, there will be Chinese Encoding Problems, relatedArticleIntroduction too
A little more, a lot of Google, the key is that MySQL 4.1 began to support multi-encoding. Today, I tried migration and insertion and reading and found some rules and problems, which are summarized as follows:
My machine is a Win2000 Server with MySQL 4, MySQL 4.1, and MySQL 5 installed. It uses phpMyAdmin 2.70 pl2.
First, I used phpMyAdmin to save a table in MySQL 4 as an ABC. SQL file.
Then, I will recover to MySQL 5 and use phpMyAdmin to input http: // localhost/phpmyadmin5/index. php (on the machine
Three phpMyAdmin instances are configured in the same version, but they connect to MySQL 4, MySQL 4.1, and MySQL 5 respectively.
Function, select gb2312 (this step is very important !), Then, the data table is imported,
Observe that at this time, each column of the data table is sorted by gb2312_chinese_ci, And the homepage set by phpMyAdmin
MySQL Character Set combination is uft-8, connection proofread is also uft-8, at the same time, in my. ini, Set
[Mysqld]
Character_set_server = utf8
[MySQL]
Default-character-set = utf8
At this time, we can see that the database is viewed with phpMyAdmin, and there is no Chinese garbled problem.

Next, we will go to PhPProgramNormal reading and adding operations to the database like previously written crud programs. There is no Chinese encoding problem.

Next, we use the same method to restore the data table to the MySQL 4.1 database. Note that during import
The code is gb2312, but an error occurred in phpMyAdmin. However, ignore the error and find that the table is still imported.
There is no problem with Chinese characters, but note that the PHP program must handle the problem like this; otherwise, there is a garbled problem.
<?
Header ("Content-Type: text/html; charset = uft-8 ");
Mysql_query ("set names utf8 ;");

Next, the MySQL statement is normal.

.....
?>
 
 

Related Article

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: info-contact@alibabacloud.com 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.