I wrote a tool which could replay MySQL sessions in real-time.
It's simple to use it and just do the following steps:
1)check it out from
https://github.com/wangbin579/tcpcopy
2)./configure --enable-mysqlsgt
It should be noticed that mysql in the test server needs to work in skip-grant-table mode.
3) run
3.1) on the target host (root privilege is required):
using ip queue (linux kernel < 3.5):
modprobe ip_queue
iptables -I OUTPUT -p tcp --sport 3306 -j QUEUE
./intercept
or
using nfqueue (linux kernel >= 3.5):
iptables -I OUTPUT -p tcp --sport 3306 -j NFQUEUE
./intercept
3.2) on the source host (root privilege is required):
./tcpcopy -x 3306-targetServerIP:3306
Please try it and leave feedback!