set names影响下面3个字符集
1 2 3 4 5 6 7
| mysql> show variables like "character_set%"; +--------------------------+------------------------------------------------------+ | Variable_name | Value | +--------------------------+------------------------------------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_results | utf8
|
- character_set_client影响MySQL服务器对client传过来语句的解析处理
- character_set_connection影响MySQL服务器决定存储数据前是否需要转换编码
- character_set_results影响MySQL服务器返回的结果编码
总之这3个值就是要一样,还要和客户端一致,所以才有了 set names 这个快捷命令