According to the MYSQL8 docs:
Several questions about character set and collation handling for client connections can be answered in terms of system variables:
- What character set are statements in when they leave the client?
The server takes the character_set_client system variable to be the character set in which statements are sent by the client.- What character set should the server translate statements to after receiving them?
To determine this, the server uses the character_set_connection and collation_connection system variables:
The server converts statements sent by the client from character_set_client to character_set_connection. Exception: For string literals that have an introducer such as _utf8mb4 or _latin2, the introducer determines the character set. See Section 10.3.8, “Character Set Introducers”.
After reading the quote, I am confused. Does the document want to tell us that if an introducer is used, the introducer will replace the character_set_connection encoding?
Or let me give a specific example, is there any difference between executing select _gbk '中文';
and executing select '中文';
? How does the introducer _gbk
affect the server's character set conversion for statements?
I hope someone can help me explain the meaning of the official descriptions and this example of mine, thank you very much.
The reference link : charset-connection