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