Understanding of MySQL character set encoding

Source: Internet
Author: User
Regardless of the version of the mysql client that the client uses to connect to the server, it is found that character_set_client, character_set_connection, character_set_results will always be consistent with the server after the character-set-serverutf8 is set on the server side, even if the option -- defa

No matter which version of mysql client the client uses to connect to the server, it is found that as long as character-set-server = utf8 is set on the server side, character_set_client, character_set_connection, and character_set_results are always consistent with those on the server side, even if the option -- defa

No matter which version of mysql client is used by the client to connect to the server, it is found that

Character-set-server = utf8,

Character_set_client, character_set_connection, character_set_results

It will always be consistent with the server, even if you add the option on the mysql client

-- Default-character-set = utf8

No, unless the connection is in, and then manually execute the command

Set names latin1 to change the character set of client, connection, and results.

After careful comparison, I finally found that another option was set on the server side:

Skip-character-set-client-handshake

The explanation for this option in this document is as follows:

-- Character-set-client-handshake

Don't ignore character set information sent by the client. to ignore client information and use the default server character set, use -- skip-character-set-client-handshake; this makes MySQL behave like MySQL 4.0

In this case, it is also beneficial. For example, If you enable the skip-character-set-client-handshake option, you can avoid client program misoperations by using other character sets to connect and write data, leading to Garbled text.

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.