设置写入db和db返回读出结果的字符集character set


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