This section describes how to enable mysql Logging in linux/windows. For more information, see.
Mysql logs started in linux
The following configuration is placed under [mysqld ]:
The Code is as follows: |
Copy code |
# Querying logs Log =/var/log/mysql_query.log # Slow query logs Long_query_time = n maximum time used to execute slow queries (10 s by default ). Log-slow-queries =/var/log/mysql_slowquery.log
# Update logs Server-id = 1 Log-bin = binlog Log-bin-index = binlog. index
|
The following is a windows-enabled mysql Log.
The configuration process is as follows:
Edit my. ini, locate the [msqld] section, and add the following command:
The Code is as follows: |
Copy code |
[Mysql] Log = "E:/mysqllog/mysql. log" |
Restart mysql
The Code is as follows: |
Copy code |
Mysql> show variables like "log % "; + --------------------------------- + ---------------- + | Variable_name | Value | + --------------------------------- + ---------------- + | Log | ON | | Log_bin | ON | | Log_bin_trust_function_creators | OFF | | Log_error |./ts17-113.err | | Log_slave_updates | OFF | | Log_slow_queries | OFF | | Log_warnings | 1 | + --------------------------------- + ---------------- + |
Here, the log line shows that the log is enabled.
Open E:/mysqllog/mysql. log and you can see the command you just used.
Mysql. log File
The Code is as follows: |
Copy code |
D:/Program Files/MySQL Server 5.0/bin/mysqld-nt, Version: 5.0.22-community-nt-log. started: TCP/IP Port: 3306, Named Pipe: (null) Time Id Command Argument 110704 15:57:39 1 Connect root @ localhost on kbq 1 Query show variables like "log %" 110704 15:58:52 1 Query select database () 110704 15:58:57 1 Query select * from test 110704 15:58:59 1 Query show tables |