The general query log is a general record of what mysqld is doing. The server writes information to this log when clients connect or disconnect, and it logs each SQL statement received from clients. The general query log can be very useful when you suspect an error in a client and want to know exactly what the client sent to mysqld.
Older versions of the mysql.server script (from
MySQL 3.23.4 to 3.23.8) pass a
--log option to
safe_mysqld to enable the general query log. If
you need better performance when you start using MySQL in a
production environment, you can remove the
--log option from
mysql.server or change it to
--log-bin. See
Section 5.3.4, “The Binary Log”.
mysqld writes statements to the query log in the order that it receives them, which might differ from the order in which they are executed. This logging order contrasts to the update log and the binary log, which are written after the query is executed but before any locks are released. (Also, the query log contains all statements, whereas the update and binary logs do not contain statements that only select data.)
To enable the general query log, start mysqld
with the
--log[=
or file_name]-l [
option.
file_name]
If the general query log file is enabled but no name is specified,
the default name is
and
the server creates the file in the same directory where it creates
the PID file. If a name is given, the server creates the file in
the data directory unless an absolute path name is given to
specify a different directory.
host_name.log
Server restarts and log flushing do not cause a new general query log file to be generated (although flushing closes and reopens it). On Unix, you can rename the file and create a new one by using the following commands:
shell>mvshell>host_name.loghost_name-old.logmysqladmin flush-logsshell>mvhost_name-old.logbackup-directory
On Windows, you cannot rename the log file while the server has it open. You must stop the server, rename the file, and then restart the server to create a new log file.
To disable or enable general query logging for the current
connection, set the session
sql_log_off variable to
ON or OFF.
The general query log should be protected because logged statements might contain passwords. See Section 5.4.2.1, “Administrator Guidelines for Password Security”.

User Comments
On Windows, I could not get the Log Files to work using the default path of "C:/Program Files (x86)/MySQL/MySQL Server 5.1"
This was on Windows Server 2008 using 32-bit MySQL version 5.1.49
Moving the logs out of that directory and into the root C: fixed the issue for me. All I can figure is the logs don't like the parentheses in (x86), I've seen this a couple times before.
Anyway if it helps anyone, my current working my.ini file on Windows now looks like this:
[mysqld]
# Set Slow Query Log
long_query_time = 1
slow_query_log = 1
slow_query_log_file = "C:/slowquery.log"
#Set General Log
log = "C:/genquery.log"
Correct most system do not like "()" also the "." might cause issues, but it might be a good idea to have the files written some where else besides root. Maybe C:\MySql\Logs\(different sub-directory names base on category). Root should be locked down on Windows servers. Hope this helps..
The reason why the log file won't work in "C:/Program Files (x86)/MySQL/MySQL Server 5.1" is because programs need to be run with administrator privileges to be able to write or modify files within the program files folder.
Find "datadir" in "my.ini": for me the line is
datadir="C:/ProgramData/MySQL/MySQL Server 5.5/Data/"
Likly that something along this path is what you want
Add your own comment.