这个错误到底是什么?

发布于 2024-08-24 23:07:57 字数 205 浏览 1 评论 0原文

我使用的数据库是MySQL 5.1。我相信,我在 web.config 中指定了正确的连接字符串。但是当我运行我的网络应用程序时。它抛出这个异常:-

MySql.Data.MySqlClient.MySqlException:指定为定义者的用户('root'@'%')不存在

任何帮助。为什么我会得到这个?

Database i am using is MySQL 5.1. I specified, i believe, right connectionstring in my web.config. but when i run my web app. it throws this exception:-

MySql.Data.MySqlClient.MySqlException: The user specified as a definer ('root'@'%') does not exist

Any help. Why am i getting this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

那伤。 2024-08-31 23:07:57

您已加载的存储过程的源代码可能包含“DEFINER=root@'%'”作为定义的一部分 - 看起来有点像这样:

create definer='root'@'%' procedure sp_test() begin end;

这里的问题是您的系统上没有帐户'根'@'%'。这很容易证明。从 MySQL 命令行:

show grants for 'root'@'%';

我预计这会返回一条错误消息:

ERROR 1141 (42000): There is no such grant defined for user 'root' on host '%'

修复方法是更改​​存储过程的源,或者创建丢失的帐户:

grant all on *.* to 'root'@'%' identified by 'password' with grant option;

拥有如此高的帐户通常不是一个好主意可从任何地方访问高级帐户,但那是另一回事了。

The source code for the stored procedures that you have been loading probably contain "DEFINER=root@'%'" as part of the definition - looking a bit like this:

create definer='root'@'%' procedure sp_test() begin end;

The problem here is that you do not have an account on your system for 'root'@'%'. This can be easily demonstrated. From the MySQL command line:

show grants for 'root'@'%';

I expect that this will come back with an error message:

ERROR 1141 (42000): There is no such grant defined for user 'root' on host '%'

The fix is to alter the source of your stored procedures, or to create the missing account:

grant all on *.* to 'root'@'%' identified by 'password' with grant option;

It is not generally a good idea to have such a high-powered account accessible from anywhere, but that is another story.

ι不睡觉的鱼゛ 2024-08-31 23:07:57

我知道这个答案来得很晚,但我找到了一个根本不涉及更改任何权利的解决方案。

进入存储过程并删除 DEFINER 子句。服务器应该写入一个与您登录时使用的用户信息相匹配的新定义器。

为我工作...

I know this answer comes very late, but I found a solution that doesn't involve changing any rights at all.

Go into your Stored Procedures and delete the DEFINER clause. The server should write in a new DEFINER that matches the user information you're logged in with.

Worked for me...

哑剧 2024-08-31 23:07:57

这是在存储过程中吗?那么也许这篇博文会有所帮助(强调我的)。

所有设置都很好,我想知道是什么导致了问题。一开始我以为这可能是一个缓存,因为我最近请求在我们的服务器上安装 xcache。

但事实并非如此。这个错误比人们想象的要愚蠢得多。 该特定脚本使用存储过程向 MySQL 插入数据或从 MySQL 获取数据。创建 sp 的用户被删除了。 这就是问题所在。 MySQL 中的术语“定义者”是创建存储过程的人,并且要执行该存储过程,用户必须存在。

Is this in a stored procedure? Then maybe this blog post helps (emphasis mine).

All the settings were fine and I was wondering what’s causing the problem. At first rush I thought that it could be a cache, as I had requested recently to have xcache on our server.

But it wasn’t the case. The error was much more stupid than even one can imagine. That specific script uses a stored procedure to insert / fetch data to/from MySQL. The user who had created the sp was the one who was deleted. And that was the problem. The term “Definer” in terms of MySQL is the one who creates the stored procedure and for the stored procedure to be executed that user must exists.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文