MySQL 5.5客户端字符集相关参数
短信预约 -IT技能 免费直播动态提醒
character_set_client 在客户端发出SQL语句所使用的字符集。
collation_connection 连接所使用的字符集校对规则
character_set_results 返回到客户端的查询结果集(例如查询结果或错误信息)所使用的字符集
character_set_connection The character set used for literals that do not have a character set introducer and for number-to-string conversion
--指定客户端当前会话使用的字符集
SET NAMES会同时更改character_set_client, character_set_connection,character_set_results这三个会话参数的字符集
mysql> set names utf8;
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like '%character%';
+--------------------------+-----------------------+
| Variable_name | Value |
+--------------------------+-----------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | gbk |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | gbk |
| character_set_system | utf8 |
| character_sets_dir | /data/share/charsets/ |
+--------------------------+-----------------------+
8 rows in set (0.00 sec)
SET CHARACTER SET会更改character_set_client、character_set_results,同时将character_set_connection设置为character_set_database这个系统参数的值
mysql> set character set latin2;
Query OK, 0 rows affected (0.01 sec)
mysql> show variables like '%character%';
+--------------------------+-----------------------+
| Variable_name | Value |
+--------------------------+-----------------------+
| character_set_client | latin2 |
| character_set_connection | gbk |
| character_set_database | gbk |
| character_set_filesystem | binary |
| character_set_results | latin2 |
| character_set_server | gbk |
| character_set_system | utf8 |
| character_sets_dir | /data/share/charsets/ |
+--------------------------+-----------------------+
8 rows in set (0.00 sec)
collation_connection 连接所使用的字符集校对规则
character_set_results 返回到客户端的查询结果集(例如查询结果或错误信息)所使用的字符集
character_set_connection The character set used for literals that do not have a character set introducer and for number-to-string conversion
--指定客户端当前会话使用的字符集
SET NAMES会同时更改character_set_client, character_set_connection,character_set_results这三个会话参数的字符集
mysql> set names utf8;
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like '%character%';
+--------------------------+-----------------------+
| Variable_name | Value |
+--------------------------+-----------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | gbk |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | gbk |
| character_set_system | utf8 |
| character_sets_dir | /data/share/charsets/ |
+--------------------------+-----------------------+
8 rows in set (0.00 sec)
SET CHARACTER SET会更改character_set_client、character_set_results,同时将character_set_connection设置为character_set_database这个系统参数的值
mysql> set character set latin2;
Query OK, 0 rows affected (0.01 sec)
mysql> show variables like '%character%';
+--------------------------+-----------------------+
| Variable_name | Value |
+--------------------------+-----------------------+
| character_set_client | latin2 |
| character_set_connection | gbk |
| character_set_database | gbk |
| character_set_filesystem | binary |
| character_set_results | latin2 |
| character_set_server | gbk |
| character_set_system | utf8 |
| character_sets_dir | /data/share/charsets/ |
+--------------------------+-----------------------+
8 rows in set (0.00 sec)
免责声明:
① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。
② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341