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
3 Answers
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
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.
-
1Thanks. This is a worked for me, also it solved problem with MySQL Workbench, when I couldn't to connect him to mysql-server. Commented May 4, 2018 at 11:51
-
This happened to me when homebrew on OSX updated Maria and locked me out of my dev dbs. Thanks!!– GregCCommented Jul 22, 2018 at 19:55
-
8This answer applies to non-docker based MySQL installations as well. Commented Nov 9, 2018 at 20:14
It may occur after some time after you set up your new system.
As a suggested solution, just try on Windows
1) open cmd.exe
as Administrator
2) run mysql_upgrade.exe -uyour_user_name -pyour_password
mysql_upgrade.exe
can be located at
C:\Program Files\MySQL\MySQL Server 8.0\bin
Then run the following to see if the infoschema user has appeared.
select user, host from mysql.user;
-
2Worked like a champ on mac os x too?
mysql_upgrade
from terminal. Commented Jun 15, 2018 at 20:59 -
10
mysql_upgrade -u root
worked for me too in macOS high Sierra Commented Jul 11, 2018 at 10:01
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.
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.
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.
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.
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.