mysql导入数据库中的存储过程和函数出现错误的解决办法

调用一个远程拷贝的本地Mysql的储存过程

报错:[Err] 1449 - The user specified as a definer ('repl'@'192.168.1.%') does not exist

 解决想法:

凭借以前经常见到的root@localhost报错,给root赋值所有权限:

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

 flush privileges;

 发现无效。

 原因:可能数据库没有此用户:

 select user,host from mysql.user;

 结果:没找到此用户,但是报错出现了这个用户。

解决方法: 

SELECT definer,type FROM mysql.proc GROUP BY definer,type;

UPDATE mysql.proc SET definer='root@localhost' WHERE definer = 'repl@192.168.1.%'; 

重启数据库,OK