mysql 5.5.19初始化数据库错误

初始化命令:

/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/

 

错误日志:

[root@localhost ~]# less /data/mysql/localhost.localdomain.err 

120710 20:36:24 mysqld_safe Starting mysqld daemon with databases from /data/mysql

120710 20:36:24 [ERROR] COLLATION 'utf8_general_ci' is not valid for CHARACTER SET 'latin1'

120710 20:36:24 [ERROR] Aborting

解决:修改my.cnf后重新初始化

 

[client]

default-character-set = utf8

 

[mysqld]

character_set_server=utf8

 

注:如果设为gbk,虽然初始化成功,但是在其它服务器上的导入数据库时可能会报错。