MySQL command line Client garbled

Source: Internet
Author: User
Tags mysql command line
MySQL stores Chinese characters and displays garbled characters using MySQL command line client. However, you can use MySQL admin/sqlyog to view the configuration file my. INI, which contains the encoding method settings for the client and server.
If the default encoding on the server is set to utf8, the data is stored in utf8 mode, which is correct. However, if you want to view the data from MySQL command line client, that is, the client, if the default encoding set by the client is utf8, garbled characters will occur. Therefore, you can change the default encoding of the client to GBK without affecting the encoding used by data storage, only when we use MySQL command line client to view data, the returned data is converted to GBK Encoded chinese characters.
This eliminates the need to set names "GBK" every time.

The specific settings are as follows:
In my. ini:

Client:

[Client]

Port = 3306

[MySQL]

Default-character-set = GBK

Server:

[Mysqld]

# The default character set that will be used when a new schema or table is
# Created and no character set is defined
Default-character-set = utf8 from: http://hi.baidu.com/%CE%A4%CF%F2%D1%F4/blog/item/571aa686b1d43226c75cc31f.html

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.