Administration MySQL

Install mtop on centos 6

Install RPMForge on CentOS 6

# wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
# rpm -Uvh rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

Import RPMForge Repository Key in CentOS 6


# wget http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
# rpm --import RPM-GPG-KEY.dag.txt

Install Mtop in CentOS 6

Once you’ve installed and enabled RPMForge repository, let’s install MTOP using following YUM command.


# yum install mtop

To start Mtop program, you need to connect to your MySQL Server, using following command.


# mysql -u root -p

Then you need to create separate user called mysqltop and grant privileges to him under your MySQL server. To do, this just run the following commands in mysql shell.


mysql> grant super, reload, process on *.* to mysqltop;
Query OK, 0 rows affected (0.00 sec)

mysql> grant super, reload, process on *.* to mysqltop@localhost;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit;
Bye

Let’s start the Mtop program.


# mtop

Sample Output:

load average: 0.03, 0.06, 0.08 mysqld 5.5.44-cll-lve up 4 day(s), 19:08 hrs
12 threads: 1 running, 0 cached. Queries/slow: 5/0 Cache Hit: 100.00%
Opened tables: 0  RRN: 332  TLW: 1  SFJ: 0  SMP: 0  QPS: 0

ID       USER     HOST             DB           TIME   COMMAND STATE        INFO
39965    mysqltop localhost                            Query                show full processlist

Monitor Remote MySQL Server using Mtop


# mtop  –host=remotehost –dbuser=username –password=password –seconds=1