How to enable mysql Log in linux/windows

Source: Internet
Author: User

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

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.