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
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.)
file_name value is given for
default name is
server creates the file in the data directory unless an absolute
path name is given to specify a different directory.
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:
On Windows, you cannot rename the log file while the server has it open. You must stop the server and rename the file, and then restart the server to create a new log file.
can be set to
disable or enable general query logging for the current
The general query log should be protected because logged statements might contain passwords. See Section 220.127.116.11, “Administrator Guidelines for Password Security”.