Tag Archives: The user specified as a definer (‘root’@’%’) does not exist

[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.

[Solved] MYSQL8.0 Error: the user specified as a definer (‘root’@’%’) does not exist

Description (can be ignored, see the solution below directly)

When modifying database data, the user-specified as a definer (‘root ‘@’% ‘) does not exist error is encountered

Using the method of Online

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

Prompt syntax error

The reason is that mysql8.0 grant authorization is not followed by identified by

Re-enter

grant all privileges on *.* to 'root'@'%';

Error again

After querying the data, it is found that it is a version problem. After version 8.0.11, the grant statement is removed to add users, that is, Grant… Can only be applied to existing accounts, not through grant   To add an account.

resolvent

mysql> create user 'root'@'%' identified by 'password';
Query OK, 0 rows affected (2.35 sec)
 
mysql> grant all privileges on *.* to 'root'@'%';
Query OK, 0 rows affected (0.06 sec)
 
mysql> flush privileges;
Query OK, 0 rows affected (0.06 sec)

Local processing

create user 'root'@'%' identified by '1234';

grant all privileges on *.* to 'root'@'%';

flush privileges;

end!