We would like to turn on query logging so we can find queries that change data.
It it possible to do transaction logs to a database? what is the difference between binlog and the general query开发者_StackOverflow社区 log?
If enabled, the binary log includes all queries that modify data. But you should be aware of the format. It's stored in binary format, so you need to convert it to get the actual SQL. Also, if you're using row-based replication with MySQL 5.1 or later, then you may not be able to get the actual SQL statements that ran.
The general query log includes all queries, even SELECTs that do not modify data.
You should take a look at mk-query-digest, which offers several different ways to monitor queries.
binlog is used to record all the changes happening in a database. Main uses of bin log is to do replication (Keep other copies of database up-to-date) and backup. You can retrieve all the write queries from binlog using mysqlbinlog
utility.
General query log is used mainly for server debigging or slow query monitoring.
For your use case you can enable bin log with statement mode
精彩评论