SET NAMES '
charset_name
' [COLLATE 'collation_name
']
SET NAMES
indicates what character set the client will use to send SQL statements to the server. Thus,SET NAMES 'cp1251'
tells the server, “future incoming messages from this client are in character setcp1251
.” 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.)
A SET NAMES '
statement is equivalent to these three statements:x
'
SET character_set_client = x; SET character_set_results = x; SET character_set_connection = x;