Mysql 错误:尝试转储表空间时,指定为定义者的用户 ('mysql.infoschema'@'localhost') 不存在'

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/49992868/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 22:55:06  来源:igfitidea点击:

Mysql Error:The user specified as a definer ('mysql.infoschema'@'localhost') does not exist' when trying to dump tablespaces

mysql

提问by stackzhao

After I upgraded MySQL 5.7 to MySQL 8.0, I started MySQL again and I got an error:The user specified as a definer ('mysql.infoschema'@'localhost') does not exist' when trying to dump tablespaces. I don't understand why this problem occurs. And I want to know how to solve it

将 MySQL 5.7 升级到 MySQL 8.0 后,我再次启动 MySQL,但出现错误:尝试转储表空间时,指定为定义者的用户 ('mysql.infoschema'@'localhost') 不存在。我不明白为什么会出现这个问题。我想知道如何解决它

回答by Alwinius

I had the same error when I accidentally downgraded my MySQL version from 8 to 5.7. At the first start the older version broke something so that version 8 was showing the error above. In my case I had to enter the docker container where MySQL was running first

当我不小心将 MySQL 版本从 8 降级到 5.7 时,我遇到了同样的错误。在第一次启动时,旧版本破坏了一些东西,因此版本 8 显示了上面的错误。在我的情况下,我必须进入 MySQL 首先运行的 docker 容器

docker exec -it mysql bash

Then I basically followed the steps here

然后我基本上按照这里的步骤

mysql -u root -p
mysql> SET GLOBAL innodb_fast_shutdown = 1;
mysql_upgrade -u root -p

This took some minutes but then everything was working again.

这花了几分钟的时间,但随后一切又恢复了。

回答by Mikhail D

It may occur after some time after you set up your new system.

它可能会在您设置新系统一段时间后发生。

As a suggested solution, just try on Windows

作为建议的解决方案,只需在 Windows 上尝试

1) open cmd.exeas Administrator

1)cmd.exe以管理员身份打开

2) run mysql_upgrade.exe -uyour_user_name -pyour_password

2)运行 mysql_upgrade.exe -uyour_user_name -pyour_password

mysql_upgrade.execan be located at

mysql_upgrade.exe可以位于

C:\Program Files\MySQL\MySQL Server 8.0\bin

Then run the following to see if the infoschema user has appeared.

然后运行以下命令查看 infoschema 用户是否出现。

select user, host from mysql.user;

回答by ZZZ

In my case, such error was caused by that I had changed the host of the dba user from % to localhost to strengthen the security.

就我而言,这种错误是由于我将 dba 用户的主机从 % 更改为 localhost 以加强安全性。

I used "abcdba" with DDL right to create db schema, and used "abc" with CURD right for the Web service to use the DB. After the change, the read operations were OK but the write operations failed with the error message in the OP.

我使用带有 DDL 权限的“abcdba”来创建数据库架构,并使用带有 CURD 权限的“abc”让 Web 服务使用数据库。更改后,读取操作正常,但写入操作失败,并在 OP 中显示错误消息。

Flush privilege or restarting the server did not solve the problem. Then I changed to host of the dba user back to %. Then things have become normal again.

刷新权限或重新启动服务器都没有解决问题。然后我将 dba 用户的主机改回 %. 然后事情又恢复正常了。

Apparently mysql does not like the changes of host of the dba user, and existing databases created by that dba user will have problem if the host of the dba user is changed.

显然mysql不喜欢dba用户主机的变化,如果dba用户的主机发生变化,该dba用户创建的现有数据库就会出现问题。

Essentially, changing the host of the dba user is actually removing user abcdba@% and creating a new user abcdba@localhost. Here had come the error message, since abcdba@% and abcdba@localhost are 2 differently fully qualified usernames.

本质上,更改 dba 用户的主机实际上是删除用户 abcdba@% 并创建一个新用户 abcdba@localhost。这里出现了错误消息,因为 abcdba@% 和 abcdba@localhost 是 2 个不同的完全限定用户名。