我在尝试更改MySQL中的字符集时遇到了麻烦。我正在尝试使用“http://stackoverflow.com/questions/3513773/change-mysql-default-character-set-to-utf8-in-中的信息编辑文件”/etc/my.cnf“我-CNF”。问题是,将此信息添加到我的文件(以及从互联网上获取的许多其他信息),MySQL服务器无法启动(重新启动以实现更改)。我收到这条消息:
[root@tribals ~] # /etc/init.d/mysql restart
Shutting down MySQL.. SUCCESS!
Starting MySQL................................... ERROR!
更具体地说,我还会发布“my.cnf”文件的内容:
[mysql]
default-character-set=utf8
[client]
default-character-set=utf8
[mysqld]
max_connections=200
query_cache_type=1
query_cache_size=2M
query_cache_limit=1M
ft_min_word_len=2
ft_max_word_len=20
ft_stopword_file=''
我在文件底部添加了关于charsets的新内容,紧接在最后一行之后。这是我要添加的代码:
default-character-set = utf8
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8
谢谢!
编辑:嗨,这是日志所说的内容:
111111 20:18:00 mysqld started 111111 20:18:00 InnoDB: Started; log sequence number 0 72790
111111 20:18:00 [Warning] './mysql/host' had no or invalid character set, and default character set is multi-byte, so character column sizes may have changed
111111 20:18:00 [Warning] './mysql/user' had no or invalid character set, and default character set is multi-byte, so character column sizes may have changed
111111 20:18:00 [Warning] './mysql/db' had no or invalid character set, and default character set is multi-byte, so character column sizes may have changed
111111 20:18:00 [ERROR] Fatal error: mysql.user table is damaged or in unsupported 3.20 format.
111111 20:18:00 mysqld ended
PD:对不起,我是新来的,找不到怎么做......
答案 0 :(得分:2)
得到了!!!在我的情况下,从3.2到4.1.22更新MySQL版本时看起来这是一个问题。问题是特权表也必须更新,但不知何故他们不是。所以,我通过SSH以root身份登录服务器并执行命令:
mysql_fix_privilege_tables --password=[your_root_pass]
就是这样!希望在我的情况下帮助别人......