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. terraform 阿里云基本使用

    1. 预备环境 安装了terraform 的软件的操作系统(windows linux mac 均可) 具有阿里云账户的 access_key secret_key 2. 配置 // terrafor ...

  2. vscode使用Markdown文档编写

    首先安装vscode工具,具体的使用可以参考之前的博文:<Visual Studio Code教程:基础使用和自定义设置> VScode已经默认集成markdown文档编辑插件.可以新建一 ...

  3. Voting and Shuffling to Optimize Atomic Operations

    2iSome years ago I started work on my first CUDA implementation of the Multiparticle Collision Dynam ...

  4. php跨域问题

    http://www.cnblogs.com/xiezn/p/5651093.html

  5. MySQL for Linux错误: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

    参考链接:http://www.cnblogs.com/gumuzi/p/5711495.html

  6. nginx安装及编译参数详解

    1.centos下Yum安装 Nginx yum list|grep nginx 发现没有可用的结果通过创建下面的文件在系统中添加nginx仓库的yum配置vi /etc/yum.repos.d/ng ...

  7. (转)使用PowerDesigner生成HTML功能

    本文转载自:http://www.cnblogs.com/CowboyProgrammer/archive/2009/04/28/1445423.html 使用PowerDesigner设计数据库关系 ...

  8. MongoDB 4.X搭建

    一.MongoDB4.X搭建 1.下载mongdb安装包,在官网上找到对应的版本,我的是centos7 找到上面的连接,通过命令行: 2.将下载的mongodb-linux-x86_64-4.0.0. ...

  9. winform问题集锦

    正试图在 os 加载程序锁内执行托管代码.不要尝试在 DllMain 或映像初始化函数内运行托管代码 说明 .NET2.0中增加了42种非常强大的调试助手,MDA.Loaderlock 是其中之一.L ...

  10. Winform绑定图片的三种方式

    1.绝对路径: this.pictureBox2.Image=Image.FromFile("D:\\001.jpg"); 2.相对路径: Application.StartupP ...