MySQL Chinese garbled problem

Source: Internet
Author: User

MySQL garbled problem:

What happens: When you use the command line to view database data, the Chinese language is displayed as garbled.

Error when inserting Chinese data with command line.

Solution Ideas:

1, enter at the command line: [Show variables like ' character_set_% ';], if the list in the query is encoded in UTF8 (except for [Character_set_filesystem]), It is the problem of encoding format that indicates the problem of Chinese garbled characters. 1 is shown

Figure 1

2, it is necessary to change (client, connection and result set) encoding mode to gb2312 (or GBK), can correctly display Chinese and write Chinese data. You only need to enter it at the MySQL command line: [Set names GBK;] Can. 2, shown in Figure 3.

Figure 2

3, so you can display the correct Chinese. As shown in 3.

Figure 3

4, after the operation is completed, it is necessary to change the encoding method back, in the MySQL command line input: [set names UTF8;] , then the encoding method is changed back to UTF8.

    

  

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.