[Solved] MYSQL Error: The user specified as a definer (‘root’@’%’) does not exist

Recently, I imported a library and found that the function reported an error. At first glance, it was a view error. At first glance, Navicat reported an error directly. The user specified as a definer (‘root’@’%’) does not exist。

Solution:

Because the person who created the view

Solution 1

If you only have the current user and you do not have the password of the root user, it is recommended that you delete the current view, copy the statement and re-establish it.

Solution 2

If you have power user privileges, enter commands

grant all privileges on *.* to root@"%" identified by ".";
flush privileges;

Replace root with the user you want to authorize.

Add one thing

For the security of the view, please supplement.

definer

When it is defined as a determiner, the user specified by the determiner must exist in the database and have the corresponding operation permission before it can be executed successfully. It has nothing to do with whether the current user has permission.

invoker

When it is defined as invoker, it can be executed successfully as long as the executor has execution permission.

Similar Posts: