用源码编译安装mysql数据库的。失败的安装:
# cd /mnt/tool<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

# tar zxvf mysql-<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />5.0.22.tar.gz

# cd mysql-5.0.22
# ./configure --prefix=/home/soft/mysql --with-charset=gbk (说明:--prefix后面跟的是mysql的安装目录,如目录不存在则手动创建,--with-charset是设置数据库的默认字符集。)

u      编译

# make

u      安装

# make install
安装完毕在连接数据库后,导入含有gbk编码的的数据库时会出错。
按照网上的解决方法后从新编译,在打开数据库的时候出现错误:
Character set 'gbk' is not a compiled character set and is not specified in the '/home/soft/mysql/charsets/Index.xml' file
还尝试了在修改文件/etc/my.cnf文件。在[client]下添加
default-character-set = gbk
在[mysqld]下添加
default-character-set = gbk

最后都失败了。
正确的解决方法:
# ./configure --prefix=/home/soft/mysql --with-charset=gbk - - with-extra-charsets=all
下面步骤相同。
 
最后分享网友的文章:
#./configure --sysconfdir=/etc --enable-assembler --without-isam --without-innodb --enable-thread-safe-client --with-client-ldflags=-all-static --without-debug --with-charset=gbk --with-extra-charsets="gbk gb2312 big5 utf8" --with-extra-charsets=all --with-mysqld-ldflags=-all-static
./configure --prefix=/usr/local/mysql

上面的详细解释
./configure
> --prefix=/usr/local/mysql \ 指定安装目录
> --sysconfdir=/etc \ 配置文件的路径
> --localstatedir=/usr/local/mysql/data \ 数据库存放的路径
> --enable-assembler \ 使用一些字符函数的汇编版本
> --with-mysqld-ldflags=-all-static \ 以纯静态方式编译服务端
> --with-charset=GBK \ 添加GBK字符支持
> --with-extra-charsets=GBK \添加GBK字符集
> --with-extra-charsets=all \添加所有字符支持
#make       //编译
#make install   //安装
# /usr/local/mysql/bin/mysql_install_db
# chown -R mysql:mysql /usr/local/mysql/data
# cp /usr/local/mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysql
# chkconfig --add mysql
# cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf