背景:

将mysql 5.6.31版本的数据导入mysql 5.6.45后出现mysql.user表坏掉的情况 出现问题:mysql.user表坏了

root@192.168.1.2 ((none)) > grant all privileges on . to root@'%' identified by "M22221"; ERROR 1805 (HY000): Column count of mysql.user is wrong. Expected 43, found 44. The table is probably corrupted Mon Dec 13 17:31:40 2021

解决办法:1.升级mysql一下:mysql_upgrade

[work@192.168.1.2]$ mysql_upgrade -udba -pdba -h192.168.1.2 -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

2.alter user 表 mysql -u root -p use mysql; alter table mysql.user drop column default_role; alter table mysql.user drop column max_statement_time; alter table mysql.user drop column password_expired; quit