Client Program Connection Character Set Configuration ucs2 utf16 utf16le utf32 Attempting to use any of those character sets as the client character set produces an error: The same error occurs if any of those character sets are used in the following contexts, all of which result in an attempt to set  character_set_client  to the named character set: When a client connects to the server, it indicates which character set it wants to use for communication with the server. (Actually, the client indicates the default collation for that character set, from which the server can determine the character set.) The server uses this information to set the character_set_client ,  character_set_results ,  character_set_connection  system variables to the character set, and  collation_connection  to the character set default collation. In effect, the server performs the equivalent of a  SET NAMES  operation. If the server does not support the requested character set or collation, it falls back to using the server character set and collation to configure the connection. For additional detail about this fallback behavior, see Connection Character Set Error Handling. The  mysql ,  mysqladmin ,  mysqlcheck ,  mysqlimport , and  mysqlshow  client programs determine the default character set to use as follows: The OS character set is mapped to the closest MySQL character set if there is no exact match. If the client does not support the matching character set, it uses the compiled-in default. For example,  utf8 and  utf-8  map to  utf8mb4 , and  ucs2  is not supported as a connection character set, so it maps to the compiled-in default. C applications can use character set autodetection based on the OS setting by invoking mysql_options()  as follows before connecting to the server: mysql_options(mysql, MYSQL_SET_CHARSET_NAME, MYSQL_AUTODETECT_CHARSET_NAME); 1945 •Each client can autodetect which character set to use based on the operating system setting, such as the value of the  LANG  or  LC_ALL  locale environment variable on Unix systems or the code page setting on Windows systems. For systems on which the locale is available from the OS, the client uses it to set the default character set rather than using the compiled-in default. For example, setting  LANG  to ru_RU.KOI8-R  causes the  koi8r  character set to be used. Thus, users can configure the locale in their environment for use by MySQL clients. •In the absence of other information, each client uses the compiled-in default character set, usually utf8mb4 . •The  SET CHARACTER SET ’ charset_name ’  statement. •The  SET NAMES ’ charset_name ’  statement. •The  --default-character-set= charset_name  command option used by MySQL client programs such as  mysql  and  mysqladmin . mysql>  SET character_set_client = ’ucs2’; ERROR 1231 (42000): Variable ’character_set_client’ can’t be set to the value of ’ucs2’ Client Program Connection Character Set Configuration