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)