0
点赞
收藏
分享

微信扫一扫

MySQL报错ERROR 1558 (HY000): Column count of mysql.user is wrong.

醉倾城1 2022-03-25 阅读 56


MySQL报错ERROR 1558 (HY000): Column count of mysql.user is wrong.


1.今天在使用MySQL创建数据库时出现如下报错:

mysql> CREATE USER 'dev'@'%' IDENTIFIED BY '123456'; 
ERROR 1558 (HY000): Column count of mysql.user is wrong. Expected 43, found 42. Created with MySQL 50560, now running 50643. Please use mysql_upgrade to fix this error.



2.解决方法

出现这个错误主要是因为我升级了数据库没有使用过,使用如下命令即可:

[root@vm172-31-0-6 ~]# mysql_upgrade -u root -p
Enter password:
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck with default connection arguments
Warning: Using a password on the command line interface can be insecure.
Running 'mysqlcheck with default connection arguments
Warning: Using a password on the command line interface can be insecure.
mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.general_log OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.slow_log OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Running 'mysql_fix_privilege_tables'...
Warning: Using a password on the command line interface can be insecure.
Running 'mysqlcheck with default connection arguments
Warning: Using a password on the command line interface can be insecure.
Running 'mysqlcheck with default connection arguments
Warning: Using a password on the command line interface can be insecure.
OK



3.再次创建数据库

mysql> CREATE USER 'dev'@'%' IDENTIFIED BY '123456';
Query OK, 0 rows affected (0.00 sec)


发现成功创建!



-----------------------------------------要克服生活的焦虑和沮丧,得先学会做自己的主人-----------------------------------------


举报

相关推荐

0 条评论