Is it possible to query the mysql bin log for a particular query? For example, suppose I want to know if anyone in the last hour did a specific query (like 'Update tableX where userName = 'bob'"). I just want to see if a particular query has been run recently.....
Use mysqlbinlog - nix or mysqlbinlog.exe - windows
$bash>mysqlbinlog mysql_bin.log > mysql_bin.txt
After conversion You can search DML in mysql_bin.txt
mysqlbinlog ${1} |grep -i 'update\|insert\|delete\|replace\|alter' | tr ‘[A-Z]’ ‘[a-z]’|sed -e '/*/d' | sort | uniq -c | sort -nr
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With