MySQL不支持GBK编码的解决方法
Linux下用packages安装的MySQL5.1,不支持GBK编码,只支持UTF8编码。具体表现:
在打开一个用GBK编码的数据库时,提示
ERROR 1273 (HY000): Unknown collation 'gbk_chinese_ci' in table 'data_plus' definition
set names gbk; 和 SET character_set_client = gbk;提示:
ERROR 1115 (42000): Unknown character set: 'gbk'
最后没办法,只好用ports重新编译。
cd /usr/ports/databases/mysql51-server
make WITH_CHARSET=gbk WITH_XCHARSET=all WITH_COLLATION=gbk_chinese_ci BUILD_STATIC=yes install clean
(其实,在make install clean 时,就有个参数提示,把前三个设置好就可以了。)
查看支持的编码:
SHOW VARIABLES LIKE 'character_set_%';
SHOW VARIABLES LIKE 'collation_%';
相关推荐
learningever 2020-09-19
81214051 2020-06-01
ITxiaobaibai 2020-03-23
84590091 2020-02-16
Jiajinjin 2009-11-04
zhangxiaocc 2019-10-24
心中要有一片海 2012-10-22
eastnow 2012-10-11
87437616 2011-05-09
secondid 2010-07-26
qiaosym 2010-07-07
shutFuckingup 2010-06-12
81214051 2020-04-25
84590091 2020-04-22
SDUTACM 2020-02-15
xuanlvhaoshao 2020-01-23