Mysql数据库迁移报错:[Err] 1449 - The user specified as a definer ('root'@'%') does not exist

做MySQL数据库迁移,把别的某个库搞一份到我本地,其中创建视图的时候报错,如下:

[Err] 1449 - The user specified as a definer ('root'@'%') does not exist

解析:权限问题,需授权给 root 用户所有sql权限。

执行如下sql即可(其中的root对应的是自己当前所用账号的用户名。):

grant all privileges on *.* to [email protected]"%" identified by ".";