ERROR 1558 (HY000): Column count of mysql.user is wrong. Expected 43, found 42. Created with MySQL 5

在设置mysql数据库远程登录时碰到设置失败的情况,查找网上资料后记录一下

mysql> grant all privileges on *.* to root@'%'identified by '密码';
ERROR 1558 (HY000): Column count of mysql.user is wrong. Expected 43, found 42. Created with MySQL 50556, now running 50637. Please use mysql_upgrade to fix this error.
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION           
    -> ;
ERROR 1558 (HY000): Column count of mysql.user is wrong. Expected 43, found 42. Created with MySQL 50556, now running 50637. Please use mysql_upgrade to fix this error.

错误是因为升级过数据库,升级之后没更新数据库里的结构信息导致的

解决方式:

[root@VM_0_7_centos ~]# mysql_upgrade -u root -p 密码
Enter password:
Looking for 'mysql' as: mysql
......


你可能感兴趣的:(mysql)