querysniffer is a MySQL query sniffer written with Net::Pcap. It sniffs the network with pcap, extracts queries from mysql packets, and prints them on standard output.
mysqlsniff.pl [interface]
The interface is optional, defaulting to the interface returned by Net::Pcap::lookupdev (usually correct).
Further documentation is included in the script. To read, run:
perldoc mysqlsniff.pl
You can also view the HTML version of the POD here: mysqlsniff-0.10.html
Download the script alone, or a tarball containing the script and two standalone executables compiled with pp (a 32bit linux version and a 64bit linux version. Useful for running on servers without installing perl or any perl modules).
mysqlsniff-0.10.pl (script)
querysniffer-0.10.tar.gz (tarball with script and standalone executables)