MySQL5.5客户端字符集相关参数-成都创新互联网站建设

关于创新互联

多方位宣传企业产品与服务 突出企业形象

公司简介 公司的服务 荣誉资质 新闻动态 联系我们

MySQL5.5客户端字符集相关参数

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)

网站栏目:MySQL5.5客户端字符集相关参数
文章起源:http://kswsj.cn/article/jchooo.html

其他资讯