MySQL :: MySQL 8.0 Reference Manual :: 15.7.6.3 SET NAMES Statement (original) (raw)
15.7.6.3 SET NAMES Statement
SET NAMES {'charset_name'
[COLLATE 'collation_name'] | DEFAULT}
This statement sets the three session system variablescharacter_set_client,character_set_connection, andcharacter_set_results to the given character set. Settingcharacter_set_connection tocharset_name
also setscollation_connection to the default collation for charset_name
. SeeSection 12.4, “Connection Character Sets and Collations”.
The optional COLLATE
clause may be used to specify a collation explicitly. If given, the collation must one of the permitted collations for_charsetname
_.
charsetname
and_collationname
_ may be quoted or unquoted.
The default mapping can be restored by using a value ofDEFAULT
. The default depends on the server configuration.
Some character sets cannot be used as the client character set. Attempting to use them with SET NAMES produces an error. SeeImpermissible Client Character Sets.