客戶要求 GBK 字符集,官方二進制包為 latin1,需源碼編譯。編譯參數與啟動報錯解決如下。
# 下載源碼
wget https://dev.mysql.com/downloads/mysql/5.1.html mysql-5.1.32.tar.gz
tar zxf mysql-5.1.32.tar.gz
cd mysql-5.1.32
# 配置:指定 GBK 為默認字符集,啟用所有字符集
./configure --prefix=/usr/local/mysql5 \
--with-charset=gbk \
--with-extra-charsets=all \
--with-plugins=federated
make && make install
[ERROR] /usr/local/mysql5/libexec/mysqld: unknown option '--skip-federated'
[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
my.cnf,**註釋** skip-federated(新版本不再支援該參數)。--with-plugins=federated,配置文件用 federated 參數啟用。mysql_upgrade 創建 mysql.plugin 表。SHOW VARIABLES LIKE 'character_set_%';
-- character_set_server = gbk
-- character_set_database = gbk