How To Install Mytop on Ubuntu 16.04 LTS

Install Mytop on Ubuntu 16

Mytop is an open source and free monitoring program for MySQL databases, using Perl language and it provides a command-line shell interface to monitor real time MySQL threads, queries per second, process list and performance of databases and gives an idea for the database administrator to optimize the server to handle heavy load.

mytop is a console-based (non-gui) tool for monitoring the threads and overall performance of a MySQL 3.22.x, 3.23.x, and 4.x server. It runs on most Unix systems (including Mac OS X) which have Perl, DBI, and Term::ReadKey installed. And with Term::ANSIColor installed you even get color. If you install Time::HiRes, you’ll get good real-time queries/second stats. As of version 0.7, it even runs on Windows (somewhat).

Install Mytop on Ubuntu 16.04 LTS

This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Mytop database performance monitoring on a Ubuntu 16.04 (Xenial Xerus) server.
install mytop on ubuntu 16

Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

sudo apt-get update
sudo apt-get upgrade

Step 2. Installing Mytop.

After system update use the following command to install mytop:

apt-get install mytop

Step 3. Configuring Mytop.

Create a .mytop file in your root directory. This file will configure Mytop with default settings for the root user. The password line should contain your MySQL root password:

cd /root
nano .mytop

Add the following content in the file and save and exit:

user=root
pass=PASSWORD
host=localhost
db=mysql
delay=1
port=3306
socket=
batchmode=0
header=1
color=1
idle=1

You can now run the “mytop” command to connect to your MySQL database and examine its performance:

MySQL on localhost (5.5.47-MariaDB) up 0+00:47:45 [06:36:47]
Queries: 1.4k qps: 0 Slow: 0.0 Se/In/Up/De(%): 56/06/13/01
qps now: 4 Slow qps: 0.0 Threads: 1 ( 1/ 0) 00/00/00/00
Key Efficiency: 76.9% Bps in/out: 260.6/400.4 Now in/out: 48.1/11.2k
Id User Host/IP DB Time Cmd Query or State
-- ---- ------- -- ---- --- ----------
46 root localhost mysql 0 Query show full processlist

Congratulation’s! You have successfully installed Mytop. Thanks for using this tutorial for installing Mytop database performance monitoring on Ubuntu 16.04 LTS (Xenial Xerus) system. For additional help or useful information, we recommend you to check the official Mytop web site.

You Might Also Like: How To Install Mtop (MySQL Database Server Monitoring) on CentOS 6