码迷,mamicode.com
首页 > 数据库 > 详细

mysql 客户端调用 远程主机的mysql

时间:2014-08-29 12:51:57      阅读:236      评论:0      收藏:0      [点我收藏+]

标签:style   color   os   使用   io   ar   cti   sp   amp   

set names utf8;

SET NAMES显示客户端发送的SQL语句中使用什么字符集。因此,SET NAMES ‘cp1251‘语句告诉服务器将来从这个客户端传 来的信息采用字符集cp1251”。它还为服务器发送回客户端的结果指定了字符集。(例如,如果你使用一个SELECT语句,它表示列值使用了什么字符 集。)

下面看看效果:

mysql> show variables like ‘%character%‘;
+--------------------------+----------------------------------------------+
| Variable_name | Value |
+--------------------------+----------------------------------------------+
| character_set_client | gbk |
| character_set_connection | gbk |
| character_set_database | gbk |
| character_set_filesystem | binary |
| character_set_results | gbk |
| character_set_server | gbk |
| character_set_system | utf8 |
| character_sets_dir | /home/work/lamp/mysql5/share/mysql/charsets/ |
+--------------------------+----------------------------------------------+
8 rows in set (0.00 sec)

mysql> set names utf8;
Query OK, 0 rows affected (0.00 sec)

mysql> select * from tbl_flowdis_limit 0,500;
+----+----------+-------+-----+--------------+
| id | domain | area | isp | node |
+----+----------+-------+-----+--------------+
| 1 | hiphotos | hubei | ct | 西安电信 |
| 2 | 1111 | hubei | ct | 北京电信 |
| 3 | skycn | anhui | cnc | 北京联通 |
+----+----------+-------+-----+--------------+
3 rows in set (0.00 sec)

mysql>
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 | /home/work/lamp/mysql5/share/mysql/charsets/ |
+--------------------------+----------------------------------------------+
8 rows in set (0.00 sec)

mysql 客户端调用 远程主机的mysql

标签:style   color   os   使用   io   ar   cti   sp   amp   

原文地址:http://www.cnblogs.com/xaf-dfg/p/3944625.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!