13.7.6.2 SET CHARACTER SET Statement语句

SET {CHARACTER SET | CHARSET}
    {'charset_name' | DEFAULT}

This statement maps all strings sent between the server and the current client with the given mapping. 此语句使用给定的映射映射服务器和当前客户端之间发送的所有字符串。SET CHARACTER SET sets three session system variables: character_set_client and character_set_results are set to the given character set, and character_set_connection to the value of character_set_database. SET CHARACTER SET设置三个会话系统变量:character_set_clientcharacter_set_results设置为给定字符集,character_set_connection设置为character_set_database的值。See Section 10.4, “Connection Character Sets and Collations”.请参阅第10.4节,“连接字符集和排序规则”

charset_name may be quoted or unquoted.可以加引号也可以不加引号。

The default character set mapping can be restored by using the value DEFAULT. 可以使用DEFAULT值恢复默认字符集映射。The default depends on the server configuration.默认值取决于服务器配置。

Some character sets cannot be used as the client character set. 某些字符集不能用作客户端字符集。Attempting to use them with SET CHARACTER SET produces an error. 试图将它们与SET CHARACTER SET一起使用会产生错误。See Impermissible Client Character Sets.请参阅不允许的客户端字符集