After a migration from mariadb to mysql-community, I have this error when I try to grant new users:
ERROR 1805 (HY000): Column count of mysql.user is wrong. Expected 43,
found 45. The table is probably corrupted
As I got the backup from as server I didn't own, I do'nt know the exact version of maria-db. But my mysql-server version is: community-server-5.6.38-2
解决方案
I tried the solution posted on a lot of forums
mysql_upgrade --force -uroot -p
But this didn't give the expected results.
So I comparated the fields list from a brand new mysql community server and mine. And discovered that the 3 problematic fields where:
is_role
default_role
max_statement_time
So I did:
mysql -e "ALTER TABLE mysql.user DROP COLUMN is_role, DROP default_role, DROP max_statement_time" -uroot -p
And this worked