mysql 3009_ERROR 3009 (HY000): Column count of mysql.user is wrong…..

在测试备份还原时,使用XtraBackup还原数据库后,创建一个测试账号时遇到了下面错误:

mysql> grant all on house.* to test@'192.168.%' identified by 'test1249';

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

mysql>

因为备份的数据库版本为MySQL 5.6.20,目标数据库的MySQL版本为5.7.21,因为两个数据库版本不一致,在还原过后,忘记升级数据库(还原后没有使用mysql_upgrade升级数据结构)。其实从错误信息也能看出一二,需要执行mysql_upgrade命令会检查所有数据库中的所有表与当前版本的MySQL服务器是否不兼容。mysql_upgrade还会升级系统表,以便你可以使用一些新特性或功能。

#  mysql_upgrade -u root -pEnter password:Checking if update is needed.Checking server version.Running queries to upgrade MySQL server.Checking system database.mysql.columns_priv                                 OKmysql.db                                           OKmysql.db_database_info                             OKmysql.db_instance_info                             OKmysql.db_server_info                               OKmysql.engine_cost                                  OK............................................................................................................Upgrade process completed successfully.Checking if update is needed.

mysql_upgrade examines all tables in all databases for incompatibilities with the current version of MySQL Server. mysql_upgrade also upgrades the system tables so that you can take advantage of new privileges or capabilities that might have been added.

If mysql_upgrade finds that a table has a possible incompatibility, it performs a table check and, if problems are found, attempts a table repair. If the table cannot be repaired, see Section 2.11.3, “Rebuilding or Repairing Tables or Indexes” for manual table repair strategies.

You should execute mysql_upgrade each time you upgrade MySQL.

参考资料:

https://dev.mysql.com/doc/refman/5.7/en/mysql-upgrade.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值