mysql数据库报错The user specified as a definer (”@sa’%') does not exist。尝试过两种方式,第一种重启之后好用,但是一会就又不好用了。第二种算是一种完美的解决方法。此种报错主要是针对访问视图文件引起的。

第一种:

给root赋值所有权限:注意在命令符下面操作。

grant all privileges on *.* to root@”%” identified by “.”;
 
flush privileges;
 
但是这种重启之后一会就又不行了。
 
 
第二种:
 
复制视图创建语句,直接将create改成alter,definer改成相关的,比如root@localhost  例如:
 
用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是否更改成功了。

第三种:

修改创建视图 过程的创建人, 比如将上面sa用户 改成在 mysql.user表中存在的用户即可

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

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

转发地址:http://blog.handone.com/index.php/archives/137

The user specified as a definer (”@sa’%') does not exist 解决方法的更多相关文章

  1. mysql:The user specified as a definer ('xxx'@'%') does not exist 解决方法

    发生这种问题.大概率是用户不存在或者是权限不够 用户不存在.用可视化工具新建一个. 权限不够 ,运行下面命令: 如:我的错误: The user specified as a definer ('mo ...

  2. MySqlException: The user specified as a definer ('root'@'%') does not exist解决方法

    之前因为MySql安全问题,将root@%改为允许特定ip段进行远程连接,结果有一个接口报The user specified as a definer ('root'@'%') does not e ...

  3. mysql 数据库数据迁移 The user specified as a definer ('root'@'%') does not exist 解决方法

    从一个数据库数据迁移到本地localhost 程序在调用到数据库的视图时报错,直接在数据库中打开视图时也报错,类似: mysql 1449 : The user specified as a defi ...

  4. mysql 1449 : The user specified as a definer ('usertest'@'%') does not exist 解决方法 (grant 授予权限)

    从服务器上迁移数据库到本地localhost 执行  函数  时报错, mysql 1449 : The user specified as a definer ('usertest'@'%') do ...

  5. Java调用存储过程时报 The user specified as a definer ('root'@'%') does not exist 解决方法

    Caused by: java.sql.SQLException: The user specified as a definer (''@'') does not exist        at c ...

  6. mysql 1449 : The user specified as a definer ('root'@'%') does not exist 解决方法

    权限问题,授权 给 root  所有sql 权限 mysql> grant all privileges on *.* to root@"%" identified by & ...

  7. 4. mysql 1449 : The user specified as a definer ('test'@'%') does not exist 解决方法

    权限问题,授权 给 root  所有sql 权限 mysql> grant all privileges on *.* to test@"%" identified by & ...

  8. The user specified as a definer ('root'@'%') does not exist 解决方法

    mysql> grant all privileges on *.* to root@"%" identified by "."; Query OK, r ...

  9. mysql 1449 : The user specified as a definer ('root'@'%') does not exist 解决方法

    权限问题,授权 给 root  全部sql 权限 mysql> grant all privileges on *.* to root@"%" identified by & ...

随机推荐

  1. 1.使用Fiddler进行接口测试

    1.Fiddler既可以用来抓包数据,亦可以进行接口测试.(可参考我的另一篇博客:https://www.cnblogs.com/android-it/p/9523548.html 进行接口的编写) ...

  2. merge into报错ORA-00926、ORA-38014

    今天用ibatis写个插入操作,为了兼容修改想使用 merge into语句,以便重复插入时直接 update,具体语句如下: <insert id="wlf"> ME ...

  3. (转)Oracle 包(Package)

    本文转载自:http://www.cnblogs.com/lovemoon714/archive/2012/02/29/2373695.html 1.为什么要使用包?       答:在一个大型项目中 ...

  4. 杂项-EMS:CRM

    ylbtech-杂项-EMS:CRM CMS是"Content Management System"的缩写,意为"内容管理系统". 内容管理系统是企业信息化建设 ...

  5. C#字符串Split方法的误区

    string s = "aaa1bbb2ccc1ddd";        string[] ss = s.Split("12".ToCharArray()); ...

  6. 转gif图

    用QQ影音截取影片 + Ulead GIF Animator510编辑.

  7. 循序渐进Python3(十三) --0-- django之form表单

    django为我们提供了form表单验证功能,下面来学习一下: 武sir博客:http://www.cnblogs.com/wupeiqi/articles/5246483.html  创建了djan ...

  8. Hadoop Serialization -- hadoop序列化详解 (3)【ObjectWritable,集合Writable以及自定义的Writable】

    前瞻:本文介绍ObjectWritable,集合Writable以及自定义的Writable TextPair 回顾: 前面了解到hadoop本身支持java的基本类型的序列化,并且提供相应的包装实现 ...

  9. consul watch

    consul watch -type key -key mhc ./key_handler.py [root@mhc consul]# cat key_handler.py #!/usr/bin/py ...

  10. Python常用算法

    本节内容 算法定义 时间复杂度 空间复杂度 常用算法实例 1.算法定义 算法(Algorithm)是指解题方案的准确而完整的描述,是一系列解决问题的清晰指令,算法代表着用系统的方法描述解决问题的策略机 ...