SET NAMES 'charset_name'

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 SELECTstatement.)

SET NAMES 'x' statement is equivalent to these three statements:

SET character_set_client = x; SET character_set_results = x; SET character_set_connection = x; 

你可能感兴趣的:(mysql)