The error log contains information indicating when mysqld was started and stopped and also any critical errors that occur while the server is running. If mysqld notices a table that needs to be automatically checked or repaired, it writes a message to the error log.
Beginning with MySQL 4.0.10, you can specify where
mysqld writes the error log with the
option. If the option is given with no
mysqld uses the name
default. The server creates the file in the data directory unless
an absolute path name is given to specify a different directory.
(Prior to MySQL 4.0.10, the Windows error log name is
mysql.err.) If you flush the logs using
FLUSH LOGS or
mysqld renames the current log file with the
-old, then creates a new empty log file.
Be aware that a second log-flushing operation thus causes the
original error log file to be lost unless you save it under a
different name. For example, you can use the following commands to
save the file:
No error log renaming occurs when the logs are flushed if the server is not writing to a named file.
In older MySQL versions on Unix, error log handling was done by
mysqld_safe which redirected the error file to
could change this file name by specifying a
option to mysqld_safe.
On Windows, error output is always written to the
.err file if
--console is not given.
In addition, on Windows, events and error messages are written to
the Windows Event Log within the Application log. Entries marked
written to the Event Log, but informational messages (such as
information statements from individual storage engines) are not
copied to the Event Log. The log entries have a source of
MySQL. You cannot disable writing information
to the Windows Event Log.
--log-warnings option or
log_warnings system variable can
be used to control warning logging to the error log. The default
value is enabled (1) as of MySQL 4.0.19 and 4.1.2. Warning logging
can be disabled using a value of 0. As of MySQL 4.0.21 and 4.1.3,
the value can be greater than 1. If the value is greater than 1,
aborted connections are written to the error log. See
Section B.5.2.11, “Communication Errors and Aborted Connections”.