In this tutorial, we will show you how to install and configuration Mytop on Ubuntu 16.04 LTS server. For those of you who didn’t know, 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 a heavy load.
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.04 LTS
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 uses 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
Congratulations! 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.