MySQL source, mysqldump import and export data

Source: Internet
Author: User

Solved the import and export problem of MySQL GBK encoding, thanks to the author.

First, import data

1, determine the database default encoding, such as encoding for GBK, the read-in path encoding is also set to GBK, the command is:
Set names GBK;
2, source d:/20080613.sql import data. Verify that the data in the database is garbled.

3, if there is still garbled problem, it is necessary to consider changing the encoding of the import file, try to import, until there is no garbled appearance.

Web page data stored garbled problem in accordance with the above method can also be resolved. You can change the page encoding to the same encoding as the database. The problem is solved naturally.

4. View Character Set

Mysql> Show variables like "%char%";

II. Export of data

Mysqldump-u root-p--default-character-set= Data Encoding database name > File.sql

Define encoding Export
Mysqldump-u root-p--default-character-set=utf8 discuss_chi> dis.sql

Defining an encoding Import
Mysql-u root-p--default-character-set=utf8-f Discuss_chi<dis.sql
such as still garbled using the binary import
Mysql-u root-p--default-character-set=binary-f Discuss_chi<dis.sql


Or not, both export and import use binary mode
Export
Mysqldump-u root-p--default-character-set=binary discuss_chi> dis.sql
Import
Mysql-u root-p--default-character-set=binary-f Discuss_chi<dis.sql

Export with Port:

Mysqldump-hlocalhost-p Port-uroot-p--DEFAULT-CHARACTER-SET=GBK database> Dis.sql

MySQL source, mysqldump Import Export Data (GO)

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.