mysql:我们不能在系统表上创建触发器吗?

标签 mysql triggers system-tables

我正在尝试通过在其上编写触发器来审核 mysql.user 表中的权限更改。

insert trigger: will capture who gave the new permissions and when
update trigger: will capture who changes the privileges from what[old privilege]
remove trigger: will capture who removed the privileges and what are they

现在,我在写 like 时遇到错误

ERROR 1465 (HY000): Triggers can not be created on system tables

我们可以在系统表上创建触发器吗?是否有任何解决方法,或者它会在更高版本[> 5.1.61]中得到支持?

提前致谢。

最佳答案

不,我们不能。即使我们最关心的权限是 allsuper

See (All) and (Super) Privileges Provided by mySql

在尝试了所有类型的特权之后

grant super on *.* to root@localhost
grant all on *.* to root@localhost

我在不同的表 mysql.db 上尝试了最简单的触发器并得到了同样的错误

Triggers can not be created on system tables // Please accept this bitter truth

如果您发现任何地方都可以在系统表上创建触发器,那就错了

关于mysql:我们不能在系统表上创建触发器吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10346546/

相关文章:

mysql查询不同并排序

Mysql DATETIME相关查询 : how to calculate the expired entry?

php - Laravel - 登录sql错误

javascript - 识别谁触发了函数

sqlite - sqlite_master 中的 name 和 tbl_name 有什么区别?

sql-server - 如何检查Sql服务器中是否存在约束?

MySQL 没有使用索引

sql-server - 触发器导致死锁?

PostgreSQL:查找有关用户定义类型的信息

MySQL 更新触发器 - 如何检测未传递的值?