最近使用备份的数据库时,遇到一个报错:The user specified as a definer (‘root’@’%’) does not exist
这个错误的原因是,数据库备份是不包括视图文件的,恢复备份的数据库是没有权限访问视图文件的,所以要给数据库添加权限。

1.win+r,输入cmd进入命令提示符界面

2.mysql -u root -p
输入数据库密码后,进入mysql服务,这儿的mysql是各自的服务名,我的就叫mysql
The user specified as a definer (‘root’@‘%’)does not exist解决方法
3.grant all privileges on *.* to [email protected]"%" identified by ".";
这句的意思是给root添加访问视图的权限
The user specified as a definer (‘root’@‘%’)does not exist解决方法
4.最后更新一下权限就好了
flush privileges;
The user specified as a definer (‘root’@‘%’)does not exist解决方法
错误解决!

相关文章: