{"id":11472,"date":"2019-03-14T08:29:12","date_gmt":"2019-03-14T08:29:12","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=11472"},"modified":"2019-03-14T08:29:12","modified_gmt":"2019-03-14T08:29:12","slug":"mytop-a-useful-tool-for-monitoring-mysql-mariadb-performance-in-linux","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/14\/mytop-a-useful-tool-for-monitoring-mysql-mariadb-performance-in-linux\/","title":{"rendered":"Mytop \u2013 A Useful Tool for Monitoring MySQL\/MariaDB Performance in Linux"},"content":{"rendered":"<p><strong>Mytop<\/strong>\u00a0is an open source and free monitoring program for\u00a0<strong>MySQL<\/strong>\u00a0and\u00a0<strong>MariaDB<\/strong>\u00a0databases was written by\u00a0<strong>Jeremy Zawodny<\/strong>\u00a0using\u00a0<strong>Perl<\/strong>\u00a0language. It is much similar in look and feel of the most famous Linux system monitoring tool called\u00a0<a href=\"https:\/\/www.tecmint.com\/12-top-command-examples-in-linux\/\" target=\"_blank\" rel=\"noopener\">top<\/a>.<\/p>\n<p><strong>Mytop<\/strong>\u00a0program provides a command-line shell interface to monitor real time\u00a0<strong>MySQL\/MariaDB<\/strong>\u00a0<strong>threads<\/strong>,\u00a0<strong>queries per second<\/strong>,\u00a0<strong>process list<\/strong>\u00a0and\u00a0<strong>performance of databases<\/strong>\u00a0and gives a idea for the\u00a0<strong>database administrator<\/strong>\u00a0to better optimize the server to handle heavy load.<\/p>\n<p>By default\u00a0<strong>Mytop<\/strong>\u00a0tool is included in the\u00a0<strong>Fedora<\/strong>\u00a0and\u00a0<strong>Debian\/Ubuntu<\/strong>\u00a0repositories, so you just have to install it using your default package manager.<\/p>\n<p>If you are using\u00a0<strong>RHEL\/CentOS<\/strong>\u00a0distributions, then you need to enable third party\u00a0<a href=\"https:\/\/www.tecmint.com\/how-to-enable-epel-repository-for-rhel-centos-6-5\/\" target=\"_blank\" rel=\"noopener\">EPEL repository<\/a>\u00a0to install it.<\/p>\n<p>For other Linux distributions you can get\u00a0<a href=\"http:\/\/jeremy.zawodny.com\/mysql\/mytop\/\" target=\"_blank\" rel=\"nofollow noopener\">mytop source package<\/a>\u00a0and compile it from source as shown.<\/p>\n<pre># tar -zxvf mytop-&lt;version&gt;.tar.gz\r\n# cd mytop-\r\n# perl Makefile.PL\r\n# make\r\n# make test\r\n# make install\r\n<\/pre>\n<p>In this MySQL monitoring tutorial, we will show you how to install, configure and use\u00a0<strong>mytop<\/strong>\u00a0on various Linux distributions.<\/p>\n<p>Please note you must have running\u00a0<a href=\"https:\/\/www.tecmint.com\/install-mysql-on-rhel-centos-6-5-fedora-17-12\/\" target=\"_blank\" rel=\"noopener\">MySQL<\/a>\/<a href=\"https:\/\/www.tecmint.com\/install-mariadb-in-centos-7\/\" target=\"_blank\" rel=\"noopener\">MariaDB<\/a>\u00a0Server on the system to install and use\u00a0<strong>Mytop<\/strong>.<\/p>\n<h3>Install Mytop in Linux Systems<\/h3>\n<p>To install\u00a0<strong>Mytop<\/strong>, run the appropriate command below for your Linux distribution to install it.<\/p>\n<pre>$ sudo apt install mytop\t#Debian\/Ubuntu\r\n# yum install mytop\t        #RHEL\/CentOS\r\n# dnf install mytop\t        #Fedora 22+\r\n# pacman -S mytop\t        #Arch Linux \r\n# zypper in mytop\t        #openSUSE\r\n<\/pre>\n<h5>Sample Output :<\/h5>\n<pre>Loaded plugins: changelog, fastestmirror\r\nLoading mirror speeds from cached hostfile\r\n * base: mirrors.linode.com\r\n * epel: mirror.freethought-internet.co.uk\r\n * extras: mirrors.linode.com\r\n * updates: mirrors.linode.com\r\nResolving Dependencies\r\n--&gt; Running transaction check\r\n---&gt; Package mytop.noarch 0:1.7-10.b737f60.el7 will be installed\r\n--&gt; Finished Dependency Resolution\r\n\r\nDependencies Resolved\r\n\r\n==============================================================================================================================================================================\r\n Package                               Arch                                   Version                                              Repository                            Size\r\n==============================================================================================================================================================================\r\nInstalling:\r\n mytop                                 noarch                                 1.7-10.b737f60.el7                                   epel                                  33 k\r\n\r\nTransaction Summary\r\n==============================================================================================================================================================================\r\nInstall  1 Package\r\n\r\nTotal download size: 33 k\r\nInstalled size: 68 k\r\nIs this ok [y\/d\/N]: y\r\n<\/pre>\n<h3>How to use Mytop to Monitor MySQL\/MariaDB<\/h3>\n<p><strong>Mytop<\/strong>\u00a0needs\u00a0<strong>MySQL\/MariaDB<\/strong>\u00a0login credentials to monitor databases and connects to the server with the root username by default. You can specify the necessary options for connecting to the database server on the command-line as you run it or in the file\u00a0<code>~\/.mytop<\/code>\u00a0(for convenience as explained later on).<\/p>\n<p>Just run the following command to start the\u00a0<strong>mytop<\/strong>\u00a0and provide your\u00a0<strong>MySQL\/MariaDB<\/strong>\u00a0root user password, when prompted. This will connect to the\u00a0<strong>test<\/strong>\u00a0database by default.<\/p>\n<pre># mytop --prompt\r\nPassword:\r\n<\/pre>\n<p>Once you entered the MySQL root password you will see\u00a0<strong>Mytop<\/strong>\u00a0monitoring shell, similar to below.<\/p>\n<div id=\"attachment_28704\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/11\/MySQL-Database-Monitoring.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-28704\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/11\/MySQL-Database-Monitoring.png\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/11\/MySQL-Database-Monitoring.png 802w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/11\/MySQL-Database-Monitoring-768x184.png 768w\" alt=\"MySQL Database Monitoring\" width=\"802\" height=\"192\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">MySQL Database Monitoring<\/p>\n<\/div>\n<p>If you would like to monitor specific database, then use the\u00a0<code>-d<\/code>\u00a0option as shown below. For example the below command will monitor database\u00a0<strong>tecmint<\/strong>.<\/p>\n<pre># mytop --prompt -d tecmint\r\nPassword:<\/pre>\n<div id=\"attachment_28705\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/11\/Monitor-MySQL-Database.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-28705\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/11\/Monitor-MySQL-Database.png\" sizes=\"auto, (max-width: 998px) 100vw, 998px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/11\/Monitor-MySQL-Database.png 998w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/11\/Monitor-MySQL-Database-768x158.png 768w\" alt=\"Monitor MySQL Database\" width=\"998\" height=\"205\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Monitor MySQL Database<\/p>\n<\/div>\n<p>If each of your databases has a specific\u00a0<strong>admin<\/strong>\u00a0(for example\u00a0<strong>tecmint<\/strong>\u00a0database\u00a0<strong>admin<\/strong>), then connect using the database username and password like so.<\/p>\n<pre># mytop -u tecmint -p password_here -d tecmintdb\r\n<\/pre>\n<p>However, this has certain security implications since the user\u2019s password is typed on the command-line and can be stored in the\u00a0<a href=\"https:\/\/www.tecmint.com\/monitor-linux-commands-executed-by-system-users-in-real-time\/\" target=\"_blank\" rel=\"noopener\">shell command history file<\/a>. This file can be viewed later on by an unauthorized person who might land on the username and password.<\/p>\n<p>To avoid the risk of such a scenario, use the\u00a0<code>~\/.mytop<\/code>\u00a0config file to specify options for connecting to the database. Another advantage of this method is that you also do away with typing numerous command-line arguments each time you want to run\u00a0<strong>mytop<\/strong>.<\/p>\n<pre># vi ~\/.mytop\r\n<\/pre>\n<p>Then add the necessary options below in it.<\/p>\n<pre>user=root\r\npass=password_here\r\nhost=localhost\r\ndb=test\r\ndelay=4\r\nport=3306\r\nsocket=\r\n<\/pre>\n<p>Save and close the file. Then run\u00a0<strong>mytop<\/strong>\u00a0without any command-line arguments.<\/p>\n<pre># mytop\r\n<\/pre>\n<p>It has a capability to show large amount of information on the screen and has many keyboard shortcut options too, check out \u201c<strong>man mytop<\/strong>\u201d for more information.<\/p>\n<pre># man mytop\r\n<\/pre>\n<p><strong>Read Also<\/strong>\u00a0:<\/p>\n<ol>\n<li><a href=\"https:\/\/www.tecmint.com\/install-mtop-mysql-database-server-monitoring-in-rhel-centos-6-5-4-fedora-17-12\/\" target=\"_blank\" rel=\"noopener\">Mtop (MySQL Database Monitoring) in RHEL\/CentOS\/Fedora<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/install-innotop-to-monitor-mysql-server-performance\/\" target=\"_blank\" rel=\"noopener\">Innotop to Monitor MySQL Performance<\/a><\/li>\n<\/ol>\n<p>In this article, we have explained how to install, configure and use\u00a0<strong>mytop<\/strong>\u00a0in Linux. If you have any questions, use the feedback form below to reach us.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/mytop-mysql-mariadb-database-performance-monitoring-in-linux\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mytop\u00a0is an open source and free monitoring program for\u00a0MySQL\u00a0and\u00a0MariaDB\u00a0databases was written by\u00a0Jeremy Zawodny\u00a0using\u00a0Perl\u00a0language. It is much similar in look and feel of the most famous Linux system monitoring tool called\u00a0top. Mytop\u00a0program provides a command-line shell interface to monitor real time\u00a0MySQL\/MariaDB\u00a0threads,\u00a0queries per second,\u00a0process list\u00a0and\u00a0performance of databases\u00a0and gives a idea for the\u00a0database administrator\u00a0to better optimize the server &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/14\/mytop-a-useful-tool-for-monitoring-mysql-mariadb-performance-in-linux\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Mytop \u2013 A Useful Tool for Monitoring MySQL\/MariaDB Performance in Linux&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-11472","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/11472","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=11472"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/11472\/revisions"}],"predecessor-version":[{"id":11473,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/11472\/revisions\/11473"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=11472"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=11472"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=11472"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}