On the nixcp.com server the other day I found something weird when I was about to grant MySQL privileges to a new MySQL user. When I ran the SQL query, an error appeared on the screen:
ERROR 1805 (HY000): Column count of mysql.user is wrong. Expected 43, found 42. The table is probably corrupted
This was the exact output:
[firstname.lastname@example.org:~]mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 37 Server version: 5.6.36 MySQL Community Server (GPL) Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> GRANT ALL PRIVILEGES ON database_wordpress.* TO 'user2'@'localhost' IDENTIFIED BY 'XXX'; ERROR 1805 (HY000): Column count of mysql.user is wrong. Expected 43, found 42. The table is probably corrupted mysql> quit Bye [email@example.com:~]
How can I fix this MYSQL ERROR 1805 (HY000) Column count of mysql.user is wrong?
ERROR 1805 (HY000): Column count of mysql.user is wrong. Table is probably corrupted error can be fixed by running a simple mysql_upgrade command.
mysql_upgrade tool is used often to check for mysql table incompatibilities (crashed or corrupted tables) running on the current MySQL version. It can also be used to upgrade mysql tables if needed. In this case, we will use it to fix any corrupted tables.
Run this command as you see below:
mysql_upgrade -u root -p
Also, restart the mysql service by running:
service mysqld restart
That’s all, now your Column count of mysql.user is wrong error should be fixed.
Do you know other ways to fix this MySQL corrupted table issue? Please share your knowledge with us.