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. element resetFields 方法报错

    resetFields  对整个表单进行重置,将所有字段值重置为初始值并移除校验结果:如果用了之后报错如下: 查了下资料,是DOM加载的顺序问题: 解决方法: this.$nextTick(() =& ...

  2. 对实体 "useSSL" 的引用必须以 ';' 分隔符结尾。

    <property name="connection.url">jdbc:mysql://127.0.0.1/cache?useUnicode=true&cha ...

  3. 支付宝RSA签名

    1.参考网上相关文章,开放php中的openssl,但使用网上例子调用openssl_pkey_new,一直报100013错误.后改用用支付宝提供的SDKdemo程序 发现使用提供的privkye,可 ...

  4. 运行maven打出来的jar包报错:Unable to locate Spring NamespaceHandler for XML schema namespace

    问题背景:新建了一个maven项目,打了一个可运行jar包,依赖了spring几个jar包,一跑就报错了 E:\workspace\point-circle\target>java -jar p ...

  5. c++ 浅谈 new 的使用

    实例用法: 创建对象: class U_Ptr smart; U_Ptr* ptr = new U_Ptr(); class U_Ptr smart(new U_Ptr(p)); int *p = n ...

  6. 利用全局变量$_SESSION和register_shutdown_function自定义会话处理

    register_shutdown_function 可以注册一个自定义的函数,在程序运行结束之前 执行. 在做ecshop的二次开发过程中,虽然代码 太老太乱太冗余,但ec的会话处理的设计感觉还是不 ...

  7. java从键盘输入一组数据,输出其最大值,平均值,最小值没法输出

    总结::需要耐心,加思考.做事不思考,那就是白做徒劳!!!!! package com.aini; import java.util.Scanner; //操...为什么数组的大小比较我硬是搞不懂,比 ...

  8. HDFS之五:Hadoop 拒绝远程 9000 端口访问

        最近学习Hadoop 时发现在本机访问 hadoop 9000 端口没有问题,但是远程机器访问 9000端口时不能访问,通过telnet 命令诊断发现发现无法访问端口,经过网上搜索解决方案结合 ...

  9. mysql函数之六:mysql插入数据后返回自增ID的方法,last_insert_id(),selectkey

    mysql插入数据后返回自增ID的方法 mysql和oracle插入的时候有一个很大的区别是,oracle支持序列做id,mysql本身有一个列可以做自增长字段,mysql在插入一条数据后,如何能获得 ...

  10. php获取当前月月初至月末的时间戳,上个月月初至月末的时间戳

    当前月 <?php $thismonth = date('m'); $thisyear = date('Y'); $startDay = $thisyear . '-' . $thismonth ...