在FreeBSD下安装mysql支持GBK字符集:
#cd/usr/ports/databases/mysql51-server
# make WITH_CHARSET=gbk WITH_XCHARSET=all WITH_PROC_SCOPE_PTH=yes
BUILD_OPTIMIZED=yes BUILD_STATIC=yes SKIP_DNS_CHECK=yes
WITHOUT_INNODB=yes install clean
# cp /usr/local/share/mysql/my-small.cnf /etc/my.cnf
mysqld中加入bind_address=127.0.0.1
#rehash
#mysql_install_db
#chown –R mysql:mysql /var/db/mysql
#/usr/local/etc/rc.d/mysql-server forcestart
#/usr/local/bin/mysqladmin -u root password 'new-password'
mysql启动没有问题了,在rc.conf中添加mysql_enable="YES"
rhel4
Character set 'gbk' is not a compiled character set and is not
specified in the '/usr/local/mysql/share/mysql/charsets/Index.xml' file
解决方法是在用configure生成Makefile时指定默认的编码和collation,即用如下选项配置mysql
./configure --prefix=/usr/local/mysql --with-charset=gbk
--with-collation=gbk_chinese_ci
--with-extra-charsets=big5,ascii,gb2312,gbk,utf8,latin1,ucs2
第一次只指定了charset没有指定collation,编译后还存在同样的不识别gbk的问题,第二次全部指定就可以了
阅读(1582) | 评论(0) | 转发(0) |