5.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_%';