MySql Chinese garbled problem (3)

Source: Internet
Author: User

MySql Chinese garbled problem (3)

The MySql client is on the dos interface, but the default character set encoding method on the dos interface is: GBK

(1) MySql character conversion Principle


(2). view all the encoding methods of the server: <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> Vc3ryb25np1_vcd4kpha + PHN0cm9uZz4mZ3Q7c2hvdyB2YXJpYWJsZXMgbGlrZSA = "character % ';


(3). If you do not want to see Chinese garbled Characters During viewing, you must specify the encoding method of the client, the encoding method of the connector, and the encoding method of the returned data;

# Set the client to GBK:
> Set character_set_client = gbk;

# Set UTF8 for the connector

> Set character_set_connection = utf8;

# If a return value exists, set the returned value to be encoded in GBK format:

> Set character_set_results = gbk;

Note: These are only limited to the current dos black screen interface, and are restored after restart. If you want to change it completely, go to the MySql Installation File, modify the my. ini configuration file, and find default_character_set = gbk in the client;

(Only modify the client)

(4) use set names gbk; (you can set these three methods in the same format at one time)



(5) Conclusion: After understanding the above schematic, there are two solutions to solve the garbled problem:
1> modify the input and output MySQL environment variables to GBK or GB2312 on the current MySQL client (currently valid)
2> modify the my. ini file in the MySQL directory and change the default encoding method of the client to GBK or GB2312. Note that you need to restart the MySQL service.




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.