开发者

Logging only insert, update and delete mysql queries

开发者 https://www.devze.com 2023-04-09 06:37 出处:网络
I\'m using a WAMP server with phpmyadmin and MySQL 5.0. I\'ve been looking for a way to only log all insert, update and d开发者_运维百科elete queries, to no avail though.

I'm using a WAMP server with phpmyadmin and MySQL 5.0. I've been looking for a way to only log all insert, update and d开发者_运维百科elete queries, to no avail though.

I did manage to get it to auto generate logs adding the "log=C:\wamp\mysql\log\queries.log" line to the my.ini configuration file of mysql, but the log didn't log the exact queries.

What i'm trying is that, whenever an insert, delete or update query happens, it logs the query in a file or in another table. Is this possible with procedures? What are my choices?


This is achieved through the Binary Log . You enable it using the log-bin parameter.
You can read the contents of a binary log using this utility, the mysqlbinlog .


There is a workaround. You can pass the tail's output to grep, e.g. like this:

tail -f /var/log/mysql/mysql.log | grep "update "
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号