How to view SQL executed by MySQL.

Source: Internet
Author: User
Tags what sql

Sometimes when the program is updated, the database load suddenly comes up, or the number of concurrent doubled. This time if with show full processlist; There is no full SQL at all. How to see what SQL is causing it, on the Internet to check the information, there are several methods.

1. Log Slow logs:

Long_query_time = 1

Log_slow_queries =/tmp/mysql-slow.log

2. View the bin Log

Mysqlbinlog mysql-bin.000042 |grep "Table_map" > Xyq.sql

3. Each line of instructions that MySQL executes can be recorded.

Log =/tmp/mysql.log

How to view SQL executed by MySQL.

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.