This is on MySQL 5.0.
I have a legacy program that had a weird occurrence happen where it set every value for a column in the database to ’19’. We are confident we’ve tracked down most every way it could happen, but there’s literally hundreds of queries, all getting built in line, that could be changing this.
Some think we were hacked, but the code is so spaghetti anything could of happened.
Instead of getting into each method and trying to fire it off (which… I didn’t see anything obvious that’d do this, so we’re talking days…) I’m wondering if I can set a trigger to record the queries being ran on a table. This way we can monitor how it happened and hopefully find the culprit.
You cannot use a trigger to record queries.
However you can use the logging facilities in MySQL to track the queries run.
The general query log looks to be the most useful for your purpose:
http://dev.mysql.com/doc/refman/5.1/en/query-log.html
The link will give you all the details you need.
Note that turning the general log
onwill slow down your server a lot.