Linux/windows enable the MySQL logging method detailed

Source: Internet
Author: User

Linux system boot MySQL log

The following configuration is placed under [mysqld]

The code is as follows Copy Code

#查询日志
Log=/var/log/mysql_query.log


#慢查询日志
Long_query_time = n the upper limit for execution of slow queries (the default setting is 10s).
Log-slow-queries=/var/log/mysql_slowquery.log


#更新日志
Server-id = 1
Log-bin = Binlog
Log-bin-index = Binlog.index


windows enable MySQL logging is attached below


The following is the entire process of configuration
Edit My.ini, find 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 |
+---------------------------------+----------------+

Log here can see that the logs are enabled.

Open E:/mysqllog/mysql.log and see the command you just used

Mysql.log file

The code is as follows Copy Code
D:/program files/mysql/mysql Server 5.0/bin/mysqld-nt, Version:5.0.22-community-nt-log. Started with:
TCP 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
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.