Database plays a very important part in any CMS or website as it stores the complete data but this database sometime becomes headache. Your website start running slow and when you contact your hosting company you get reply “You need to optimize your database” OR sometime for hosting company also its very hard to explain high resource usage by MySQL Database as usually System Admins are depended on “top” command which doesn’t provide accurate information.

MyTop is a console based utility which helps user to monitor the threads and performance of MySQL Database Server. This utility is easy to install and useful for Database Administrators, Server Administrators. In this article I will explain how to install and use MyTop.

1) Download: Download latest version of myTop from using command wget

root@server [~]# wget

2) Extract and go to mytop directory

root@server [~]# tar -zxvf mytop-1.6.tar.gz
root@server [~]# cd mytop-1.6
root@server [~/mytop-1.6]

3) Installation of MyTop: Copy and Paste following commands to install MyTOP on your Server

root@server [~/mytop-1.6]# perl Makefile.PL
root@server [~/mytop-1.6]# make
root@server [~/mytop-1.6]# make test
root@server [~/mytop-1.6]# make install

4) Configure MyTop: To get results from MyTop you have user various command-line arguments like username, password, hostname (you can check all options using command “man mytop”)etc. everytime OR you can setup a config file and mention everything in that.
Create and open file “~/.mytop” (copy and paste name as written) using your favraite editor and then copy paste following conent

user=[database user]
pass=[password of the user]
host=[IP or hostname of the host]
db=[database name]
port=[Port Number]

Make sure it should look like:

5) Checking Mysql Usage: You can check the MySQL usage using command “mytop

root@server [~]# mytop

Which will show output like below

*** Problem: When you execute mytop you will get error “Error in option spec: “long|!”

root@server [~/mytop-1.6]# mytop
Error in option spec: “long|!”
root@server [~/mytop-1.6]#

To fix this error you have to edit mytop script. To find the exact path of mytop script use command “which

root@server [~]# which mytop
root@server [~]#

Now edit “/usr/local/bin/mytop” using any editor like vi, nano etc. and change

“long|!” => \$config{long_nums},


“long|long_nums|l!” => \$config{long_nums},

Save and Exit and you will able to run mytop without any problem.