如何从多个帐户触发 MySQL 触发器
这是我的情况:我有一个 MySQL 数据库,我想在其中使用触发器来自动管理一些表中的日期创建和日期修改字段的更新。后来,我想将它们扩展到记录数据更改,但目前不存在。
触发器工作正常并按预期更新字段。问题是应用程序帐户现在基本上是唯一可以影响这些表的帐户,其他 MySQL 用户帐户(例如我的)的操作会失败,因为定义者是应用程序帐户。
无论谁在桌子上执行命令,我似乎都找不到一种方法来触发触发器,这非常令人沮丧。有没有办法无论用户如何都打开触发器来触发或允许多个用户触发触发器?
我们目前运行的是 MySQL 5.0.18 - 改变这一点的可能性很小,因为这里负责基础设施的人们相当抵制修复(至少在他们看来)没有损坏的东西。
Here's my situation: I have a MySQL database in which I'd like to use triggers to automatically manage the updating of date creation and date modified fields in a few of my tables. Later, I'd like to expand them into logging data changes, but that's neither here nor there at the moment.
The triggers work fine and update the fields as intended. The problem is that the application account is now basically the only account that can affect these tables, actions from other MySQL user accounts (such as mine) fail because the definer is the application account.
I can't seem to find a way to have the trigger fire regardless of who executes a command on the tables and it's quite frustrating. Is there a way to either open up a trigger to fire regardless of user or allow multiple users to fire the trigger?
We're currently running MySQL 5.0.18 - changing this is very unlikely as the folks here in charge of infrastructure are rather resistant to fixing what (in their minds at least) isn't broken.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论