1. Problem: The recent use of MySQL database operation, in DOS use command line to the MySQL insert/read Chinese when garbled problem.
2. Reason: Because the cmd client default encoding is GBK, and I install MySQL when the encoding is UTF-8; If you want to change the character encoding of the CMD client, this is not a good line.
3. WORKAROUND: Ensure that the CMD client and MySQL are encoded in the same code.
Operation Steps:
1) Use Windows+r shortcut key, input cmd;
2) Enter Mysql-uroot-p, then enter the password into the database operation;
3) Set the database encoding:
Setcharacter_set_client=gbk;
Setcharacter_set_results=gbk;
4. Note:
1) Set the code in DOS only applicable to the current operation, after exiting the login still garbled;
2) need to be set in MySQL configuration file (My.ini or My-default.ini);
3) If the file cannot be found, please refer to my blog everything tool use Find.
Operating MySQL database in DOS garbled in Chinese