Mysql Slow Problem record database statement _mysql

Source: Internet
Author: User
Tags mysql client mysql slow query log
Need to open a slow query output of an organ: log_slow_queries. Can be set in the MySQL configuration file (my.ini/my.cnf) or through the MySQL client temporary settings. The advantage of the second approach is that you can take the settings into effect without restarting the MySQL service. Let's try this one:
First connect to the MySQL server through the client, and enter the following statement:
SET GLOBAL log_slow_queries = on;
SET GLOBAL long_query_time = 3;

This allows MySQL to record the SQL statement that takes >=3 seconds and output it to a slow query log file. Here's the question, where is this slow query log file? As follows, execute the following statement in the MySQL client:
Show variables like ' slow_query_log_file ';
You'll see the MySQL slow query log file location. Mine is:/usr/local/mysql/data/host-slow.log.
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.