用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_%';
阅读(5283) | 评论(0) | 转发(0) |