MySQL ERROR 3009 (HY000): Column count of mysql.user is wrong. Expected 45, found 42. Created with MySQL 50560, now running 50729. Please use mysql_upgrade to fix this error.

1.产生原因

在卸载原有的mysql5.5之后,安装了mysql5.7,进入数据库后,我发现原有的数据库都还在,但是在创建用户的时候报错

ERROR 3009 (HY000): Column count of mysql.user is wrong. Expected 45, found 42. Created with MySQL 50560, now running 50729. Please use mysql_upgrade to fix this error.

 原因:错误是由于你曾经升级过数据库,升级完后没有使用 mysql_upgrade升级数据结构造成的。

解决办法:更新数据库

 mysql_upgrade -uroot -p

 

 然后进入数据库,执行语句

这次没有报错

参考链接:

https://blog.csdn.net/m18994118189/article/details/83068242

原文地址:https://www.cnblogs.com/mke2fs/p/12386050.html