Solve MySQL Chinese garbled characters

Source: Internet
Author: User
Tags mysql command line

All of my friends who want to learn MySQL will encounter Chinese Garbled text, which is very annoying. Next I will talk about the solution to the MySQL Garbled text problem and share it with you, I hope to provide you with some reference.

Method 1,

Open the MySQL command line client and set the following three items:

Set character_set_client = GBK;

Set character_set_results = GBK;

Set character_set_connection = GBK;

Then, set the value of default-character-set in the my. ini file under the MySQL installation directory to GBK (note that there are two changes to be made ).

Note: This method has a defect: After modification, garbled characters in the new table disappear, but garbled characters appear in the original table. The solution is, first, export and modify the data in the original table, then recreate the table, and then import the data.

Note: For character_set_client and so on,

See Chinese manual: http://dev.mysql.com/doc/refman/5.1/zh/charset.html

Method 2,

When installing MySQL, pay attention to the encoding settings and set it to GBK. This saves the trouble in the future.

 

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.