Documentation Home
MySQL 8.0 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 43.3Mb
PDF (A4) - 43.4Mb
Man Pages (TGZ) - 297.3Kb
Man Pages (Zip) - 402.5Kb
Info (Gzip) - 4.3Mb
Info (Zip) - 4.3Mb
Excerpts from this Manual

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 forcharset_name. SeeSection 12.4, “Connection Character Sets and Collations”.

The optionalCOLLATE clause may be used to specify a collation explicitly. If given, the collation must one of the permitted collations forcharset_name.

charset_name andcollation_name 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 withSET NAMES produces an error. SeeImpermissible Client Character Sets.