When I enable the MySQL general query log, prepared statement executions are logged like this:
Execute SELECT col1, col2 FROM table1 WHERE col1 = ?
I've seen other information on the Internet that I think shows people seeing the replaced values for prepared statement arguments, but I can find no information about this at all.
I need to see the values being used in queries, and can't do it on the client side because it's compiled code (though I did try to tell it to connect on port 3306, but ngrep
shows no traffic so I suppose it's using a socket if available and I don't know how easy it would be to reconstruct prepared queries with a packet sniff anyway).
If I set long_query_time = 0
will the slow query log show the values I'm after? What other possibilities are there?
Best Answer
Setting
long_query_time = 0
andslow_query_log = 1
, restarting mysql shows queries with their actual argument values in the slow query log.I won't accept this answer pending a better way to get the general query log to show the argument values.