How can view live MySQL queries?

3 Jul

1) You can log every query to a long file really easily:

mysql> SHOW VARIABLES LIKE “general_log%”;
+——————+—————————————–+
| Variable_name | Value |
+——————+—————————————–+
| general_log | OFF |
| general_log_file | /data/mysql/mysql.log |
+——————+—————————————–+

mysql>SET GLOBAL general_log =’ON’;

2) mtop/mkill – MySQL Monitoring Tools

mtop (MySQL top) monitors a MySQL server showing the queries which are taking the most amount of time to complete. Features include ‘zooming’ in on a process to show the complete query, ‘explaining’ the query optimizer information for a query and ‘killing’ queries. In addition, server performance statistics, configuration information, and tuning tips are provided.

mkill (MySQL kill) monitors a MySQL server for long running queries and kills them after a specified time interval. Queries can be selected based on regexes on the user, host, command, database, state and query.

mtop/mkill : http://sourceforge.net/project/showfiles.php?group_id=43496

3)Graphdat

To have a graphical representation of your MySQL queries, in real time and historical, take a look at Graphdat. It’s pretty simple, run the agent and the queries show up on the dashboard.

http://www.graphdat.com/mysql

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: