Database Reference
In-Depth Information
Examples:
• Write the error log to the
err.log
file in the data directory:
[mysqld]
log_error=err.log
• As of MySQL 5.7.2, you can influence the amount of error log output by setting the
log_error_verbosity
system variable. Permitted values range from 1 (errors only)
to 3 (errors, warnings, notes; the default). To see errors only, do this:
[mysqld]
log_error=err.log
log_error_verbosity=1
• On Unix, if you start the server using
mysqld_safe
, it's possible to redirect the error
log to the
syslog
facility:
[mysqld_safe]
syslog
The general query and slow query logs
Several system variables control the general query and slow query logs. Each variable
can be set at server startup or changed at runtime:
•
log_output
controls the log destinations. The value is
FILE
(log to files, the default),
TABLE
(log to tables),
NONE
(disable logging), or a comma-separated combination
of values, in any order.
NONE
overrides any other value. If the value is
NONE
, other
settings for these logs have no effect. Destination control applies to the general query
and slow query logs together; you cannot write one to a file and the other to a table.
•
general_log
and
slow_query_log
enable or disable the respective logs. By default,
each log is disabled. If you enable either of them, the server writes the log to the
destinations specified by
log_output
, unless that variable is
NONE
.
•
general_log_file
and
slow_query_log_file
specify log filenames. The default
names are
host_name
.log
and
host_name
-slow.log
; however, these settings have no
effect unless
log_output
specifies
FILE
logging.
Examples:
• Write the general query log to the
query.log
file in the data directory:
[mysqld]
log_output=FILE
general_log=1
general_log_file=query.log