MySQL Variables log_output 数据库 参数变量解释及正确配置使用
本站中文解释
MySQL参数变量log_output的用途是设置MySQL的日志输出,用于记录MySQL运行过程中的数据状态。其设置值有四种:FILE:记录日志到文件;TABLE:记录日志到表中;NONE:不记录任何日志;BOTH:同时记录日志到文件和表中。
要设置MySQL参数变量log_output,需要在mysql命令行界面或者通过配置文件设置,具体步骤如下:
1. 使用mysql命令行界面设置:
(1)在mysql服务器上使用mysql命令行登录:mysql -u root -p (按提示输入root用户的密码)
(2)使用set语句设置log_output参数:
set global log_output = ‘FILE’;
表示将log_output参数设置为“FILE”,即将日志记录到文件中。
2. 修改配置文件设置 %mysql安装路径%\my.ini
(1)找到mysql安装路径下的my.ini文件(Windows系统)
(2)在[mysqld]节中添加如下参数:
log_output=FILE
(3)保存my.ini文件,并重新启动MySQL服务,即可让MySQL更新设置。
官方英文解释
log_output
Command-Line Format | --log-output=name |
---|---|
System Variable | log_output |
Scope | Global |
Dynamic | Yes |
Type | Set |
Default Value | FILE |
Valid Values |
|
The destination or destinations for general query log and slow
query log output. The value is a list one or more
comma-separated words chosen from TABLE
,
FILE
, and NONE
.
TABLE
selects logging to the
general_log
and
slow_log
tables in the
mysql
system database.
FILE
selects logging to log files.
NONE
disables logging. If
NONE
is present in the value, it takes
precedence over any other words that are present.
TABLE
and FILE
can both
be given to select both log output destinations.
This variable selects log output destinations, but does not
enable log output. To do that, enable the
general_log
and
slow_query_log
system
variables. For FILE
logging, the
general_log_file
and
slow_query_log_file
system
variables determine the log file locations. For more
information, see Section 5.4.1, “Selecting General Query Log and Slow Query Log Output Destinations”.