The user specified as a definer ('admin'@'%') does not exist

迁移过来的别人的数据库,在运行项目的时候,报错提示

The user specified as a definer ('admin'@'%') does not exist

admin可以是任何一个用户名,例如,你也有可能遇到:

The user specified as a definer ('root'@'%') does not exist 或者

The user specified as a definer ('user'@'%') does not exist 等等一些其他的,都可以用这个方法进行解决

问题:

出现了类似语句,问题就是登陆的该用户缺失对该数据库的一些操作权限。

解决办法:

首先,打开cmd窗口,然后输入:

mysql -hlocalhost -uroot -p密码   点击回车

接下来输入:

grant all privileges on *.* to root/admin/user/其他(错误提示哪一个就输入哪一个) @"%" identified by "密码";  分号结尾,点击回车

最后:

flush privileges;  分号结尾,点击回车

原文地址:https://www.cnblogs.com/javatalk/p/10885590.html