How to enable the MySQL slow query log under Windows

Source: Internet
Author: User
Tags mysql slow query log

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

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.