mysql中文乱码问题

需要使用的语句

set character_set_client=gbk;
set character_set_connection=gbk;
set character_set_database=gbk;
set character_set_results=gbk;
set character_set_server=gbk;

mysql客户端显示中文的正常配置

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 | C:\Program Files\MySQL\MySQL Server 5.5\share\charsets\ |
+--------------------------+---------------------------------------------------------+
8 rows in set (0.00 sec)

测试是否可以输出中文

create table user(name varchar(11));
insert into user value ("aaa");
select * from user;
insert into user value("我我我");
show create table user \G;

小结:在如上语句的配置中,测试语句输出为中文,但是还不会全局设置,在导入sql文件时,输出依旧乱码,有待解决

下次更新···

上一篇:springboot项目与数据库交互时中文编码错误问题(非???乱码)


下一篇:云数据库HBase企业级安全解析