MySQL Client Output window displays Chinese garbled problem solving method

Source: Internet
Author: User
Tags mysql client

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

Related Article

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.