Workaround:
The first step: to restore the database and tables are UTF8 format (recommended UTF8, of course GBK or gb2312 also line)
The code is as follows:
CREATE DATABASE ' Shegongku ' DEFAULT CHARACTER SET UTF8
CREATE TABLE ' Members ' (
' UID ' mediumint (8) unsigned not NULL default ' 0 ',
' username ' varchar not NULL default ',
' Password ' varchar not NULL default ',
' Salt ' varchar default NULL,
' Email ' varchar not NULL default '
) Engine=myisam DEFAULT Charset=utf8;
The second part, the conversion of the Code of the SQL file into UTF8 format, can be notepad2, can also be converted with ultraeditor, and then in the first row of the SQL file add a row of set names UTF8 save.
Part III, import. Generally will not appear garbled, then if you are in the terminal cmd query again found or garbled words, this is not a database problem, but the display of the problem, in the terminal input set names GBK, so that Chinese will show normal
Continue the document
Method one: By adding parameter –default-character-set = UTF8 solve garbled problem
Mysql-u root-p Password < Path_to_import_file–default-character-set = UTF8
Method Two: Import garbled solution on the command line
1. Use database_name;
2. Set names UTF8; (or other required encoding)
3. Source example.sql (SQL file storage path)
Method Three: Directly paste the code in the SQL file
1. Open SQLyog client software;
2. Navigate to the SQL Editor, and then use Notepad to open the SQL file just exported;
3. Copy all SQL statements from the file into the SQL editor and execute the SQL code;