Monday, 11 June 2012

How to monitor active MySQL connections(ajaxmytop)

AjaxMyTop shows active MySQL connections. You get a data grid showing connections, each showing ID, user, duration, and so on. 

 AjaxMyTop currently requires PHP5 and it may not work properly with php 4.x versions. Get it to the exact web root directory which you want to run ajaxMyTop. In my case it is /var/www/html/

# cd /var/www/html

# wget http://downloads.sourceforge.net/project/ajaxmytop/ajaxmytop/ajaxMyTop-0.7.2/ajaxMyTop-0.7.2.tar.gz

 # tar zxvf ajaxMyTop-0.7.2.tar.gz

 # mv ajaxMyTop mytop# cd mytop

Configuring AjaxMyTop

You can configure ajaxMyTop by editing the config.php file. MySQL: It is highly recommended that you create a new user for ajaxMyTop with the SUPER and PROCESS privileges rather than configure ajaxMyTop with an admin user, or continue with the default details.

mysql> GRANT SUPER, PROCESS ON *.* to ‘ajaxmytop’@'localhost’ identified by ‘ajaxmytop’;

 mysql> GRANT SUPER, PROCESS ON *.* to ‘ajaxmytop’@'%’ identified by ‘ajaxmytop’;

Apparently you must also grant the SELECT privilege to the ajaxmytop user for all databases in which you may want to explain threads.

mysql> GRANT USAGE, SELECT ON test.* to ‘ajaxmytop’@'localhost’ identified by ‘ajaxmytop’;

mysql> GRANT USAGE, SELECT ON test.* to ‘ajaxmytop’@'%’ identified by ‘ajaxmytop’;

Edit the config.php and enter the user-name and password setting which you have setup. Access it via your server ip or domain based on your installation location.

http://192.168.1.67/mytop/
 
Make sure you have .htaccess folder permission enabled on the mytop folder or else everyone can access and view your mysql query usages etc.

No comments:

Post a Comment