Turn: windows open MySQL slow query detailed

Source: Internet
Author: User

Original: http://blog.csdn.net/a11085013/article/details/17370053

Show variables like '%quer% '; query whether to open a slow query!!


Step One: Modify My.ini (mysql config file)
Add the following two words to the My.ini
Log-slow-queries = "D:\wamp\mysql_slow_query.log"
Long_query_time=5
The first sentence is used to define the path to the slow query log (because it is windows, so there is no permission issue involved)
The second sentence uses to define how many seconds of query is slow query, I define here is 5 seconds
Step Two: View the status of a slow query
Execute the following SQL statement to view the status of the MySQL slow query
Show variables like '%slow% ';
The execution results will print on the screen whether the slow query is turned on, the number of seconds to slow query, the slow query log, and so on.
Step three: Perform a slow query operation
In fact, it is difficult to perform a meaningful slow query, because when you test it, it only takes 0 seconds to query a huge list of 200,000 data. We can replace it with the following statement:
SELECT SLEEP (10);
Fourth step: View the number of slow queries
Use the following SQL statement to see how many slow queries have been performed:

Show global status like '%slow% ';

Other than that:

Steps:

1. To start MySQL like this

Go to MySQL installation directory

2. Start Xx>bin\mysqld.exe–slow-query-log This note

Test, for example, we put

SELECT * from EMP where empno=34678;

***********

Turn: windows open MySQL slow query detailed

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.