Mysql Data Conversion Guide

Source: Internet
Author: User
The following articles mainly describe the conversion guide of MySQL4.1 data. The following is a detailed description of the conversion guide of MySQL4.1 data. I hope this will be helpful in your future studies. We all know that MySQL (the best combination with PHP) 4.1 adds encoding support. Therefore, it is a little troublesome to convert old data, but only

The following articles mainly describe the conversion guide for MySQL 4.1 data. The following is a detailed description of the conversion guide for MySQL 4.1 Data. I hope this will help you in your future studies. We all know that MySQL (the best combination with PHP) 4.1 adds encoding support. Therefore, it is a little troublesome to convert old data, but only

The following articles mainly describe the conversion guide for MySQL 4.1 data. The following is a detailed description of the conversion guide for MySQL 4.1 Data. I hope this will help you in your future studies. We all know that MySQL (the best combination with PHP) 4.1 adds encoding support.

Therefore, it is a little troublesome to convert old data, but it is okay to pay attention to the following points:

1. MySQL 4.1 Data Conversion guide dump the original data before conversion

Generally, the original data is encoded in gb2312 format. The dump command is as follows:

MySQL (best combination with PHP) dump-u-p database-add-drop-table-extended-insert

-Add-drop-table is used to avoid table creation during import.-extended-insert is used to prevent an SQL statement from being too large during import, think about how terrible it is to write thousands of records in one SQL statement.

Assume that the original database is gb2312 encoded and needs to be converted to utf8 encoding. The conversion between other encodings is similar.

2. MySQL 4.1 Data Conversion Guide 2 modify the SQL file dumped by dump

Use Emeditor or iconv to convert the file encoding to UTF-8. Note that it is best not to use the Unicode signature(bom#", because the combination of mysql(and PHP is not recognized by cmd.exe. Replace gbk_bin in the file with utf8_general_ci, replace gbk with utf8, and add
Set names utf8;

With BOM, MySQL (the best combination with PHP) does not recognize the following errors:
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the ma
Nual that corresponds to your MySQL (the best combination with PHP) server version for the right syntax to use n
Ear '???
/*! 40101 SET @ OLD_CHARACTER_SET_CLIENT = @ CHARACTER_SET_CLIENT */'at line 1

3. re-create the MySQL4.1 database, and then import the backup SQL statement. The import command is as follows:
MySQL (best combination with PHP)-u-p database <dumpdata. SQL

4. MySQL 4.1 Data Conversion guide 4. If it is a previously exported file, an error occurs during import:
Got a packet bigger than 'max _ allowed_packet 'bytes
Or
ERROR 1153 (08S01) at line 616: Got a packet bigger than 'max _ allowed_packet'
Tes

You need to modify the maximum allowed package size of MySQL (the best combination with PHP). edit my. ini, add a sentence in [MySQL (the best combination with PHP) d] (not used in this Part:
Set-variable = max_allowed_packet = 10485760

Restart MySQL (the best combination with PHP) service. Here I set it to about 10 MB.

Here, the data import is basically complete, and the next step is to adjust the data according to different applications. Generally, some systems support the data, but others do not, however, the adjustment methods are roughly divided into the following types:

1. Add
MySQL (the best combination with PHP) _ connect (....
Optimal Combination of MySQL and PHP) _ query ("set names 'utf8 ′");

This is the most common case, such as Brim.

2. Set the encoding of the language file or template file to UTF-8. Note that you can directly convert the file encoding without worrying about the content, such as phpwind and mantis. The tool can be iconv and can be downloaded here.
Iconv-f gb2312-t UTF-8 gb2312.html> utf-8.html

3. Modify the template file and set

Most of the original gb2312 encoding systems need to change this.

The above content is an introduction to the MySQL 4.1 Data Conversion guide. I hope you will get some benefits.

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.