Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should I audit changes in a MySQL table (using MySQL 4)?

Tags:

mysql

audit

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?

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.

like image 769
Haabda Avatar asked Oct 20 '08 14:10

Haabda


People also ask

What is audit table in MySQL?

Audit Log Tables MySQL Enterprise Audit uses tables in the mysql system database for persistent storage of filter and user account data. The tables can be accessed only by users who have privileges for that database. The tables use the InnoDB storage engine ( MyISAM prior to MySQL 5.7. 21).

What is audit trail in MySQL?

Database table level audit trails will help us to investigate most of the application issues such as unauthorized access, problematic configuration changes, and many more.


1 Answers

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.

Having said that, I'm not sure that MySQL 4 had trigger support.

like image 155
Matt Avatar answered Oct 24 '22 13:10

Matt