[mysql报错信息]:ERROR 1558 (HY000): Column count of mysql.user is wrong.

  |   Linux Mysql

我打算要撤销已经赋予给 MySQL 用户权限的权限,但是执行命令报错
Linux自带mysql 5.1版本,后来升级到了5.6版本,执行以下命令报错

mysql> revoke all on `ghost`.* from 'root'@'localhost';
ERROR 1558 (HY000): Column count of mysql.user is wrong. Expected 43, found 39. Created with MySQL 50173, now running 50642. Please use mysql_upgrade to fix this error.

原因是因为升级不当导致,执行以下命令即可正常执行命令如下:

# mysql_upgrade -uroot -proot
Warning: Using a password on the command line interface can be insecure.
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.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.
ghost_dev.accesstokens                             OK
ghost_dev.api_keys                                 OK
ghost_dev.app_fields                               OK
ghost_dev.app_settings                             OK
ghost_dev.apps                                     OK
ghost_dev.brute                                    OK
ghost_dev.client_trusted_domains                   OK
ghost_dev.clients                                  OK
ghost_dev.integrations                             OK
ghost_dev.invites                                  OK
ghost_dev.members                                  OK
ghost_dev.migrations                               OK
ghost_dev.migrations_lock                          OK
ghost_dev.mobiledoc_revisions                      OK
ghost_dev.permissions                              OK
ghost_dev.permissions_apps                         OK
ghost_dev.permissions_roles                        OK
ghost_dev.permissions_users                        OK
ghost_dev.posts                                    OK
ghost_dev.posts_authors                            OK
ghost_dev.posts_tags                               OK
ghost_dev.refreshtokens                            OK
ghost_dev.roles                                    OK
ghost_dev.roles_users                              OK
ghost_dev.sessions                                 OK
ghost_dev.settings                                 OK
ghost_dev.subscribers                              OK
ghost_dev.tags                                     OK
ghost_dev.users                                    OK
ghost_dev.webhooks                                 OK
OK

取消授权用户如下:

mysql> revoke all on `ghost`.* from 'root'@'localhost';
Query OK, 0 rows affected (0.00 sec)

这样成功取消了授权用户