SQL Statements for Connection Character Set Configuration •Each client supports a  --default-character-set  option, which enables users to specify the character set explicitly to override whatever default the client otherwise determines. Some character sets cannot be used as the client character set. Attempting to use them with  --default-character-set  produces an error. See Impermissible Client Character Sets. With the  mysql  client, to use a character set different from the default, you could explicitly execute a  SET NAMES  statement every time you connect to the server (see Client Program Connection Character Set Configuration). To accomplish the same result more easily, specify the character set in your option file. For example, the following option file setting changes the three connection-related character set system variables set to  koi8r  each time you invoke  mysql : If you are using the  mysql  client with auto-reconnect enabled (which is not recommended), it is preferable to use the  charset  command rather than  SET NAMES . For example: The  charset  command issues a  SET NAMES  statement, and also changes the default character set that mysql  uses when it reconnects after the connection has dropped. When configuration client programs, you must also consider the environment within which they execute. See Section 10.5, “Configuring Application Character Set and Collation” . After a connection has been established, clients can change the character set and collation system variables for the current session. These variables can be changed individually using  SET  statements, but two more convenient statements affect the connection-related character set sytem variables as a group: SET NAMES  indicates what character set the client uses to send SQL statements to the server. Thus, SET NAMES ’cp1251’  tells the server, “future incoming messages from this client are in character set  cp1251 .”  It also specifies the character set that the server should use for sending results back to the client. (For example, it indicates what character set to use for column values if you use a  SELECT statement that produces a result set.) A  SET NAMES ’ charset_name ’  statement is equivalent to these three statements: Setting  character_set_connection  to  charset_name  also implicitly sets collation_connection  to the default collation for  charset_name . It is unnecessary to set that collation explicitly. To specify a particular collation to use for  collation_connection , add a  COLLATE clause: • SET CHARACTER SET ’ charset_name ’ 1946 SET NAMES ’ charset_name ’ COLLATE ’ collation_name ’ SET character_set_client =  charset_name ; SET character_set_results =  charset_name ; SET character_set_connection =  charset_name ; • SET NAMES ’ charset_name ’ [COLLATE ’ collation_name ’] SQL Statements for Connection Character Set Configuration mysql>  charset koi8r Charset changed [mysql] default-character-set=koi8r Note