mysql 8.0导致5.6数据后 :ERROR 1449 (HY000): The user specified as a definer ('mysql.infoschema'@'localhost') does not exist

  • 登录数据库后执行以下命令 mysql> show databases;

  • 报错 ERROR 1449 (HY000): The user specified as a definer ('mysql.infoschema'@'localhost') does not exist

  • 在网上找到的解决办法 mysql_upgrade -u root -p

  • 输入后,显示如下信息:

The mysql_upgrade client is now deprecated. The actions executed by the upgrade client are now done by the server.

To upgrade, please start the new MySQL binary with the older data directory. Repairing user tables is done automatically. Restart is not required after upgrade.

The upgrade process automatically starts on running a new MySQL binary with an older data directory. To avoid accidental upgrades, please use the --upgrade=NONE option with the MySQL binary. The option --upgrade=FORCE is also provided to run the server upgrade sequence on demand.

It may be possible that the server upgrade fails due to a number of reasons. In that case, the upgrade sequence will run again during the next MySQL server start. If the server upgrade fails repeatedly, the server can be started with the --upgrade=MINIMAL option to start the server without executing the upgrade sequence, thus allowing users to manually rectify the problem.

-----------------------------------------

mysql_upgrade客户机现在已经弃用。升级客户端现在执行的操作由服务器完成。
  
升级,请启动新的MySQL二进制旧数据目录。修复用户表是自动完成的。升级后不需要重启。
  
升级过程将自动启动运行一个新的MySQL二进制和另外一个年纪大的数据目录。为了避免意外升级,请使用MySQL二进制——升级=没有选项。还提供了选项,升级=力运行服务器升级需求序列。
  
有可能服务器升级失败由于很多原因。在这种情况下,升级序列将再次在接下来的MySQL服务器开始运行。如果服务器升级失败多次,服务器可以启动——升级=最小选项启动服务器没有执行升级顺序,从而允许用户手动纠正这个问题。

没办法,继续查

得知

  • MySQL 8.0.16开始 mysql_upgrade 升级程序已经废弃
一、官方为什么变更升级方式?

1. 升级速度更快

2. 升级更简单

3. 安全性更好

4. 减少升级步骤,方便自动化

5. 不需要重启 MySQL 6. 即插即用

 
二、新旧方式升级流程对比
MySQL 8.0.16 之前:



1. 关闭 MySQL,替换新的二进制 MySQL

2. 启动 MySQL,让服务器升级 DD(数据字典)表

3. 运行 mysql_upgrade,更新系统表和用户表

4. 加载新的帮助表

5. 重启 MySQL

MySQL 8.0.16 开始:



1. 关闭 MySQL,替换新的二进制 MySQL

2. 启动 MySQL,升级 DD(数据字典)表和系统表、用户表和帮助表

升级的时间和操作都会大幅度缩短,操作步骤也减少了很多,更方便了用户。

 
三、关于 MySQL 8.0.16 的新的升级方式
看看该如何使用新的升级姿势?

mysqld 额外添加了一个新的选项 --upgrade。可选值为 NONE,AUTO,MINIMAL,FORCE。

姿势是这样的:

/usr/local/mysql/bin/mysqld --upgrade=NONE

新的选项都代表什么?

**NONE:**不尝试进行升级

**AUTO:**默认选项,MySQL 进行数据字典升级和服务升级

**MINIMAL:**仅升级数据字典

**FORCE:**强制升级,类似旧的 mysql_upgrade –force

 

MySQL 8.0.16 新的升级方式,总体来说分为2个步骤。

1. 升级数据字典(DD)

2. 服务器升级:升级 MySQL 系统表、升级用户表、升级 sys 表、升级帮助更新表

可能出现的问题:

1. 升级数据字典:原子性操作。如果操作失败,则根据目录可以回滚回来。

2.升级系统表、用户表:可以从备份还原中恢复。

个人建议,针对升级:

1. 使用新的版本,尤其是 MySQL 8.0 系列。每个版本都有新特性,还有bug的修复,定期小版本升级会使你的 MySQL 更加稳定。

2. 阅读新版本的Release。 

3.最后,升级之前要做好备份,以便升级失败回滚使用。
原文地址:https://www.cnblogs.com/cheyunhua/p/14486516.html