Learn how to fix the ‘Column Count of mysql.user is Wrong’ error in MySQL. Our MySQL Support team is here to help you with your questions and concerns.
‘Column Count of mysql.user is Wrong’ Error in MySQL
Did you know that the ‘Column count of mysql.user is wrong’ error occurs when MySQL tables are not updated to match the running MySQL version?
This error can prevent user creation and password changes, often appearing after a MySQL upgrade or migration.
This error manifests when we try to create an account or change a password.
Error from MySQL query: Cpanel::Exception::Database::Error/(XID r9urzw) The system received an error from the “MySQL” database “mysql”: 1805 (Column count of mysql.user is wrong. Expected 45, found 43. The table is probably corrupted) at /usr/local/cpanel/Cpanel/DBI.pm line 200.
Additionally, MySQL logs may contain warnings like:
[Warning] [MY-013143] [Server] Column count of mysql.user is wrong. Expected 51, found 45. The table is probably corrupted.
[Warning] InnoDB: Table mysql/innodb_table_stats has length mismatch in the column name.
Causes of the Error
- Incorrect schema in MySQL system tables.
- Incomplete MySQL upgrade.
- Interrupted database migration.
- Filesystem corruption.
- Unexpected system shutdown.
- Incompatible MySQL versions.
Solution 1. Run MySQL Upgrade
A common fix is forcing MySQL to upgrade its tables. Run the following command:
mysql_upgrade --force -uroot -p
If migrating from MariaDB to MySQL or between MySQL versions, ensure compatibility before running the upgrade.
Solution 2. Remove Problematic Columns
If upgrading does not resolve the issue, manually removing mismatched columns may help:
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
Solution 3. Manually Add Missing Columns
If columns are missing rather than extra, manually add them in the correct order:
use mysql;
alter Table user ADD Create_tablespace_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Trigger_priv;
alter Table user ADD plugin char(64) DEFAULT '';
alter Table user ADD authentication_string text DEFAULT NULL;
Alternatively:
- Restart MySQL after running `mysql_upgrade`:
service mysql restart
- For MySQL 8.x, force an upgrade using:
sudo -i su -l mysql -s/bin/bash
mysqld --upgrade=FORCE &
exit
/scripts/restartsrv_mysql --stop
/scripts/restartsrv_mysql --start
[Need assistance with a different issue? Our team is available 24/7.]
Conclusion
The ‘Column count of mysql.user is wrong’ error usually results from incomplete MySQL upgrades or migrations. Running `mysql_upgrade` is the first step, but manual table modifications may be necessary in persistent cases. Always ensure backups before making changes to system tables.
In brief, our Support Experts demonstrated how to fix the Column Count error in MySQL.
0 Comments