The user specified as a definer (”@’%') does not exist 解决办法

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了The user specified as a definer (”@’%') does not exist 解决办法相关的知识,希望对你有一定的参考价值。



第一种:

给root赋值所有权限:注意在命令符下面操作。
grant all privileges on *.* to [email protected]”%” identified by “.”;
flush privileges;
但是这种重启之后一会就又不行了。


第二种:
复制视图创建语句,直接将create改成alter,definer改成相关的,比如[email protected]  例如:
用alter view 修改definer的值,alter ALGORITHM=UNDEFINED DEFINER=`public`@`192.168.0.%` SQL SECURITY DEFINER VIEW `view_product` AS 视图选择语句。

 

通过执行use information_schema;和 select TABLE_SCHEMA,TABLE_NAME,DEFINER from views; 两条语句,可以查询到definer是否更改成功了。

原因分析
因为创建视图使用的是[email protected]%用户(目前已经不存在),然后登录用户使用的是[email protected]用户,导致mysql认为现在的用户无权限访问该视图,解决方法就是在当前用户下重建该视图。

题外话:还有一种方法是如果你是运维人员,此问题直接交由程序去处理,让其检查创建触发器、视图、存储过程等sql。如果包含[email protected]%,替换之。重新创建。没有尝试过,后面可以试试。




本文出自 “魂斗罗” 博客,请务必保留此出处http://990487026.blog.51cto.com/10133282/1743965

以上是关于The user specified as a definer (”@’%') does not exist 解决办法的主要内容,如果未能解决你的问题,请参考以下文章

1449-The user specified as a difiner(‘aa‘@‘%‘) does not exist

1449-The user specified as a difiner(‘aa‘@‘%‘) does not exist

mysql的“The user specified as a definer (”@’%') does not exist”问题 解决

mysqldump: Got error: 1449: The user specified as a definer ('user'@'%') does not ex

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

mysql的The user specified as a definer (”@’%') does not exist 的解决办法