Today in testing 4 million records of MySQL slow query, database installed on Windows, Baidu a lot, there is no test feasible solution or experience, probably because the MySQL version is different! Make a record here to forget the time can be viewed, but also let other friends learn from it.
The MySQL version used here is 5.6.17
First, modify the My.ini file in MySQL, the key code is as follows:
Datadir= "D:/mysql5.6/mysql Server 5.6/data\"
log-output=file (this must be changed to file, otherwise the slow query log will not output to the log file)
Slow-query-log= on(on means enabled, 0 means off)
slow_query_log_file= "mysql-slow.log" ( slow query log file, below the DataDir directory above )
Long_query_time=1 (defined more than 1 seconds of query is slow query, test time, production environment should be adjusted according to actual needs between 1 to 10 number)
Then, finally restart the MySQL service
Restarting the MySQL service can be restarted by means of a command:
Open cmd window
net stop (MySQL service name)
net start (MySQL service name)
The MySQL service name can be found by right-clicking on the computer--management--services and applications--for example, the service named "Mysql56"
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/58/6F/wKioL1Sv8Tnw4DqNAACF4Gp19WE651.jpg "title=" 20150109231257.png "alt=" Wkiol1sv8tnw4dqnaacf4gp19we651.jpg "/>
Finally, log in to MySQL, using the command: Show variables like '%query% ', such as:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/58/72/wKiom1Sv8aiQ1WNRAAHRyhM3Iws285.jpg "title=" 20150109231840.png "alt=" Wkiom1sv8aiq1wnraahryhm3iws285.jpg "/>
Then enable success!!!
This article is from the "Hector" blog, make sure to keep this source http://ptuhlc.blog.51cto.com/4852404/1601454
How to enable the MySQL slow query log under Windows