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

时间:2022-11-21 23:03:14

The user specified as a definer ('root'@'%') does not exist 此种报错主要是针对访问视图文件引起的(没有权限)

按照下图进行操作,

1.先看下mysql是否设置了环境变量,如果没设置,就需要切换到mysql的bin目录下执行命令(我的已经设置过了)

mysql -hlocalhost -uroot -p123456

2.给root用户添加权限

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

3.刷新权限

flush privileges;