ERROR 1805(HY000):mysql.user的列数错误.预期为43,发现为45.该表可能已损坏 [英] ERROR 1805 (HY000): Column count of mysql.user is wrong. Expected 43, found 45. The table is probably corrupted
问题描述
从mariadb迁移到mysql-community后,尝试授予新用户时出现此错误:
After a migration from mariadb to mysql-community, I have this error when I try to grant new users:
错误1805(HY000):mysql.user的列数错误.预期43 发现45.该表可能已损坏
ERROR 1805 (HY000): Column count of mysql.user is wrong. Expected 43, found 45. The table is probably corrupted
当我从我不拥有的服务器上获得备份时,我不知道maria-db的确切版本.但是我的mysql服务器版本是:community-server-5.6.38-2
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.
因此,我比较了一个全新的mysql社区服务器和我的mysql的字段列表.并发现了3个有问题的字段,其中:
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
所以我做到了:
mysql -e "ALTER TABLE mysql.user DROP COLUMN is_role, DROP default_role, DROP max_statement_time" -uroot -p
这可行
这篇关于ERROR 1805(HY000):mysql.user的列数错误.预期为43,发现为45.该表可能已损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!