mysql报错解决方式:1449 - The user specified as a definer ('root'@'%') does not exist

从一个数据库数据迁移到本地localhostmysql

程序在调用到数据库的视图时报错,直接在数据库中打开视图时也报错,相似:sql

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

 

经查询是权限问题,解决办法:数据库

运行sql:bash

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

便可解决!ide

 

源地址的解释:spa

权限问题,受权 给 root  全部sql 权限code

mysql> grant all privileges on *.* to root@"%" identified by ".";
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)