×

MySQL 报错Fatal error: mysql.user table is damaged

96
极地瑞雪
2017.02.13 22:39* 字数 6

MySQL初始化问题

shell> mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

shell> service mysqld restart
Stopping mysqld:                                           [  OK  ]
MySQL Daemon failed to start.
Starting mysqld:                                           [FAILED]

#日志中报错如下:
[ERROR] Fatal error: mysql.user table is damaged. Please run mysql_upgrade.
[ERROR] Aborting

#这种情况本人是在MySQL5.1到5.7版本升级时遇到的,升级到5.7后,数据库启动失败
#解决的办法就是重新初始化数据库

shell> rm -fr /var/lib/mysql
shell> mysqld --initialize --user=mysql
shell> service mysqld restart
Stopping mysqld:                                           [  OK  ]
Starting mysqld:                                           [  OK  ]
MySQL
Web note ad 1