MySQL 触发器发送 HTTP POST 请求

2022-01-15 00:00:00 curl mariadb mysql

我想在 MySQL 中创建一个触发器,每当在表中更新/插入/删除行时,它就会向某个 URL 发送 HTTP 发布请求.我该怎么做?

I want to create a trigger in MySQL that sends an HTTP post request to some URL whenever a row is updated/ inserted / deleted in a table. How can I do it?

推荐答案

出于安全原因,MySQL 不会发送任何超出其范围的内容——没有电子邮件、没有 http 请求等.

MySQL, for security reasons, will not send anything outside of its realm -- no emails, no http request, etc.

TRIGGER 将有关操作的信息存储到表中以供审核,然后让外部程序定期轮询该表并采取行动.

Have the TRIGGER store information about the action into a table for auditing, then have an external program periodically poll that table and take actions.

相关文章