How does MySQL track SQL statements?

Source: Internet
Author: User

How does MySQL track SQL statements?

In project development, it is inevitable that you need to track SQL Execution statements on the database server. By tracking SQL Execution statements, we can determine that When Upper-layer applications are executing SQL statements, whether the database has executed SQL statements, whether the SQL statements executed are incorrect, and so on. In short, tracking SQL Execution statements on the database greatly facilitates error troubleshooting in database logic code writing.

We all know that SQL tracking uses an event probe in SQL SERVER. How can we track the executed SQL statements in MySQL?

Through some google and baidu, we found a simple but not the ultimate solution.

Solution

1. The idea is simple: Enable the MySQL log function and view the tracking log.

2. How to enable MySQL log:

[Configuration method in Windows]

Find my. ini in the Mysql Server Installation Directory, which is under the "C: \ Program Files \ MySQL Server 5.5" directory,

Find the [mysqld] field in my. ini and add: log = the log storage path/mysql. log

My Configuration:

After modifying my. ini, save the file and restart mysql to find the mysql. log File in C:/Users/Administrator.

Run an SQL statement on the MySQL client to view the mysql. log and track the SQL statements.

This article permanently updates the link address:

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.