Reprint: http://www.cnblogs.com/xdp-gacl/p/4008095.html
Only to find a way to succeed, not to find excuses for failure!
MySQL Client Output window displays Chinese garbled problem solving method
Recently, when querying the data in the table in the MySQL Client Output window, the Chinese data in the table is displayed as garbled, as shown in:
Check the Internet for a reason: garbled, is because the MySQL client Output window display in Chinese when the character encoding is incorrect, you can use the following command to view the Output window using the character encoding
'char%';
After the command execution is complete, the results are shown as follows:
As you can see, the Chinese data is now displayed using the UTF8 character encoding, but since the operating system is a Chinese operating system, the default character set used is GB2312, so you need to change the character encoding used by the Output window to gb2312 to display Chinese correctly. Use the following command to set the character encoding used by the Output window:
Set Character_set_results=gb2312;
Once the command is executed, the character encoding used in the Output window can be changed to gb2312, as shown in:
At this point we execute the query again, the Chinese data in the table can be displayed normally, as shown in:
Note: Set character_set_results=gb2312; This only temporarily sets the MySQL result set character encoding to gb2312, if you close the MySQL client window and then reopen it,
It's going to turn into a utf8.
MySQL Client Output window displays Chinese garbled problem solving method