tags:

views:

46

answers:

1

I want a simple way to see what commands are being sent to MySQL. I have several MySQL projects that sometimes have a few messy layers of code. I want something like SQL Server Profiler without all of the bells and whistles. I just need to see the SQL traffic. Not analyze which queries are executed most often.

I found MySQL Proxy and can't get it to work in Windows. I downloaded their binaries, and tried their first example LUA script from the link. It loads fine, but when I try to connect to port 4040 using mysql, I get:

ERROR 1105 (HY000): #07000MySQL Proxy Lua script failed to load. Check the error log.

What error log? I didn't even give it the credentials to connect to my real SQL Server. What can I do to get this to work? I'm open to other options (hopefully not sniffing traffic, but maybe if someone can make it easy).

+1  A: 

Enable query logging in my.ini. this will write all queries to a log file

add the line

log = [querylog_filename]

Then restart the mysql service

using a program such as tail for win http://tailforwin32.sourceforge.net/ will allow you to watch the queries as they run.

if you have a problematic query you can enable slow logging as well. which will log important details about queries that take a long time to run

DC

DeveloperChris
Perfect answer. I was trying to use binlog earlier but was very frustrated with parsing the file format. From the documentation, I believed the only difference from binlog and log was that binlog masked out selects. I didn't realize log was in a simple plaintext format. tailforwin32 is a great find. I also noticed that MySQL Administrator can also show the log (but you have to constantly refresh). Thanks again!
User1