content_image/872909.jpg
<img src='content_image/872909.jpg'>

## Note 

Some character sets cannot be used as the client character set. See Impermissible Client Character Sets. 

•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” . 

• collation_connection  is important for comparisons of literal strings. For comparisons of strings with column values, collation_connection  does not matter because columns have their own collation, which has a higher collation precedence (see Section 10.8.4, “Collation Coercibility in Expressions” ). 

•What character set should the server translate query results to before shipping them back to the client? 

The character_set_results  system variable indicates the character set in which the server returns query results to the client. This includes result data such as column values, result metadata such as column names, and error messages. 

To tell the server to perform no conversion of result sets or error messages, set character_set_results  to NULL  or binary : 

SET character_set_results = NULL; SET character_set_results = binary; 

For more information about character sets and error messages, see Section 10.6, “Error Message Character Set” . 

To see the values of the character set and collation system variables that apply to the current session, use this statement: 

SELECT * FROM performance_schema.session_variables WHERE VARIABLE_NAME IN ( ’character_set_client’, ’character_set_connection’, ’character_set_results’, ’collation_connection’ ) ORDER BY VARIABLE_NAME; 

The following simpler statements also display the connection variables, but include other related variables as well. They can be useful to see all  character set and collation system variables: 

SHOW SESSION VARIABLES LIKE ’character\_set\_%’; SHOW SESSION VARIABLES LIKE ’collation\_%’; 

Clients can fine-tune the settings for these variables, or depend on the defaults (in which case, you can skip the rest of this section). If you do not use the defaults, you must change the character settings for each connection to the server. 

## Impermissible Client Character Sets 

The character_set_client  system variable cannot be set to certain character sets: 

