Fatal error: mysql.user table is damaged. Please run mysql_upgrade

mysqld_safe –skip-grant-tables –user=root &
mysql_fix_privilege_tables
pkill mysqld
/etc/init.d/mysqld restart

Or maybe clean database file reinstall if first suggestion not working:

2016-03-23T12:23:41.909337Z 0 [ERROR] Fatal error: mysql.user table is damaged. Please run mysql_upgrade.
2016-03-23T12:23:41.909405Z 0 [ERROR] Aborting

mysql_upgrade
mysql_upgrade: Got error: 2002: Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2) while connecting to the MySQL server

Not working? Still:

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

Maybe?
mysql_install_db
[WARNING] mysql_install_db is deprecated. Please consider switching to mysqld –initialize

mv /var/lib/mysql /var/lib/mysql___
mysqld –initialize –explicit_defaults_for_timestamp –user=mysql

2016-03-23T12:29:58.232282Z 0 [Warning] InnoDB: New log files created, LSN=45790
2016-03-23T12:29:58.343355Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-03-23T12:29:58.398447Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: f4c53304-f0f2-11e5-bb28-f6d02e74bd56.
2016-03-23T12:29:58.398839Z 0 [Warning] Gtid table is not ready to be used. Table ‘mysql.gtid_executed’ cannot be opened.
2016-03-23T12:29:58.399354Z 1 [Note] A temporary password is generated for root@localhost: **********

Now restore database from: /var/lib/mysql___ or sql dump backups.

You can face this issue after MySQL server upgrade. So you need backup all database before upgrading anything.

One thought on “Fatal error: mysql.user table is damaged. Please run mysql_upgrade

Leave a Reply

Your email address will not be published. Required fields are marked *