The user specified as a definer (‘root’@‘%’)does not exist解决方法

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

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

2.mysql -u root -p
输入数据库密码后,进入mysql服务,这儿的mysql是各自的服务名,我的就叫mysql
在这里插入图片描述
3.grant all privileges on *.* to root@"%" identified by ".";
这句的意思是给root添加访问视图的权限
在这里插入图片描述
4.最后更新一下权限就好了
flush privileges;
在这里插入图片描述
错误解决!

猜你喜欢

转载自blog.csdn.net/weixin_44582716/article/details/106287844
今日推荐