Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to monitor MySQL queries on Windows

Is there any easy way to track/monitor all the SQL of the queries, executed by an MySQL server (on a Windows machine)?

Update: I am asking about the free tool.

like image 511
BreakPhreak Avatar asked Oct 04 '10 13:10

BreakPhreak


People also ask

How do I monitor MySQL queries?

MySQL users have a number of options for monitoring query latency, both by making use of MySQL's built-in metrics and by querying the performance schema. Enabled by default since MySQL 5.6. 6, the tables of the performance_schema database within MySQL store low-level statistics about server events and query execution.

How do you show the currently running queries?

MySQL SHOW PROCESSLIST show full processlist; The FULL modifier allows us to see the query text in its entirety instead of the first 100 symbols we would get without this modifier. In the id column, you will see the connection thread id of any currently running query - you can then use this id in the KILL command.

What is MySQL query analyzer?

The MySQL Query Analyzer enables developers and DBAs to quickly improve the performance of their database applications by monitoring query performance. MySQL Query Analyzer lets you accurately pinpoint SQL code that is the root cause of a slow down.


3 Answers

  1. Send this command to the server: set global general_log=1;
  2. Find the log file (the default on Win7 it resides in C:\ProgramData\MySQL\MySQL Server 5.1\data) and has a name just like the computer.
  3. Examine the log :)
  4. Set the general_log back to 0 to return the DB server performance back to normal.
like image 180
BreakPhreak Avatar answered Oct 24 '22 17:10

BreakPhreak


What worked for me on local windows 7 x64 installation of MYSQL 5.6 was:

  • Open your my.ini file and make sure you have these lines:

    Long query log

    
    long_query_time = 1
    slow_query_log = 1
    slow_query_log_file = "C:\Zend\MySQL5.6\slowquery.log"
    
    

    Set General Log

    
    general_log=1
    general_log_file = "C:\Zend\MySQL5.6\genquery.log"
    
    
  • Save file and restart the service

To switch off general query logs, set general_log value to 0 and restart. And do not forget to change the paths of log files to match your system.

like image 45
serge.k Avatar answered Oct 24 '22 16:10

serge.k


You could download a 30-day trial of: MONyog. If it's the tool for you, I suggest you buy it.

like image 29
Ruel Avatar answered Oct 24 '22 17:10

Ruel