shell 环境下MySQL的基本操作指令总结(3)

mysql> show variables like "%char%";
+--------------------------+-----------------------------------------------------+
| Variable_name | Value |
+--------------------------+-----------------------------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /data/infobright-4.0.7-x86_64/share/mysql/charsets/ |
+--------------------------+-----------------------------------------------------+
8 rows in set (0.01 sec)

2、在MySQL中执行:show variables like "%char%";
mysql> show variables like "%char%";
+--------------------------+----------------------------------------------------------------------------------------+
| Variable_name | Value |
+--------------------------+----------------------------------------------------------------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /data1/mysql_root/base/mysql_wrapper_5_6_28_20160902_tlinux_ts85/mysql/share/charsets/ |
+--------------------------+----------------------------------------------------------------------------------------+
8 rows in set (0.00 sec)

发现IB中的变量character_set_database和变量character_set_server的编码跟MySQL中的编码不一样;

在IB中执行:
SET character_set_database = utf8 ;
SET character_set_server = utf8 ;


系统变量:
– character_set_server:默认的内部操作字符集
– character_set_client:客户端来源数据使用的字符集
– character_set_connection:连接层字符集
– character_set_results:查询结果字符集
– character_set_database:当前选中数据库的默认字符集
– character_set_system:系统元数据(字段名等)字符集

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/97c6ad077c4660fd7ede2868a336c00f.html