How should I audit changes in a MySQL table (using MySQL 4)?(我应该如何审核 MySQL 表中的更改(使用 MySQL 4)?)
问题描述
我被要求审计 MySQL 表中的任何/所有更改.有谁知道有什么工具可以帮助我做到这一点,还是我需要编写自己的解决方案?
I have been asked to audit any/all changes in a MySQL table. Does anyone know of any tools out there to help me do this or do I need to write my own solution?
如果我自己编写审计,我最初的想法是制作一个单独的表并在 PHP 代码中构建一串更改.类似于fieldname1 -> oldvalue | fieldname2 -> oldvalue, ...".如果您发现此方法存在重大问题,请告诉我.
If I write my own audting, my initial thought it to make a separate table and build a string of changes in the PHP code. Something like "fieldname1 -> oldvalue | fieldname2 -> oldvalue, ...". If you see a major problem with this method, please let me know.
推荐答案
捕获对数据库表的所有更改的唯一可靠方法是在服务器上使用触发器.修改您自己的代码以审核更改的风险是无法捕获来自其他应用程序/用户等的更改.
The only sure-fire way to capture all changes to a DB table is to use triggers on the Server. The risk of modifing your own code to audit the changes is that changes from another application/user etc will not be captured.
话虽如此,我不确定 MySQL 4 是否支持触发器.
Having said that, I'm not sure that MySQL 4 had trigger support.
这篇关于我应该如何审核 MySQL 表中的更改(使用 MySQL 4)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:我应该如何审核 MySQL 表中的更改(使用 MySQL 4)?
基础教程推荐
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- 从字符串 TSQL 中获取数字 2021-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- 带更新的 sqlite CTE 2022-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
