ERROR 1805 (HY000): Column count of mysql.user is wrong. Expected 45, found 42. The table is probably corrupted

created at 12-13-2021 views: 53

background

The mysql.user table is broken after importing the data of mysql 5.5 version into mysql 5.7.

root@10.10.10.10 ((none)) > grant all privileges on *.* to 'tmp'@'localhost' identified by 'tmp' with grant option;
ERROR 1805 (HY000): Column count of mysql.user is wrong. Expected 45, found 42. The table is probably corrupted
Mon Dec 13 17:31:40 2021

Solution

Upgrade mysql: mysql_upgrade

[work@10.10.10.10]$ ./bin/mysql_upgrade -utmp -ptmp -h10.10.10.10 -P3307
mysql_upgrade: [Warning] Using a password on the command line interface can be insecure.
Checking if update is needed.
Checking server version.
Running queries to upgrade MySQL server.
Checking system database.
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.engine_cost                                  OK
...
Upgrade process completed successfully.
Checking if update is needed.
created at:12-13-2021
edited at: 12-13-2021: