Dear nixCraft,
How can I monitor what my MySQL server is doing?
Sincerely,
Confused About MySQL Server
Dear Confused,
To solve MySQL problems or to optimize MySQL server you need to use special tool called mytop. It is a UNIX top command clone for MySQL server. It updates every few seconds, so you can get a reasonable look at your SQL performance. It is capable of displaying a huge amount of information.
Debian / Ubuntu Linux: Install mytop
Use the apt-get command to install the same or download it from official web site
# apt-get install mytop
CentOS / RHEL Linux: Install mytop
First, turn on EPEL repo and type:
# yum install mytop
Sample outputs:
Loaded plugins: auto-update-debuginfo, product-id, protectbase, rhnplugin, subscription-manager Updating certificate-based repositories. Unable to read consumer identity 0 packages excluded due to repository protections Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package mytop.noarch 0:1.7-3.b737f60.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ==================================================================================================== Package Arch Version Repository Size ==================================================================================================== Installing: mytop noarch 1.7-3.b737f60.el6 epel 32 k Transaction Summary ==================================================================================================== Install 1 Package(s) Total download size: 32 k Installed size: 68 k Is this ok [y/N]: y Downloading Packages: mytop-1.7-3.b737f60.el6.noarch.rpm | 32 kB 00:00 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : mytop-1.7-3.b737f60.el6.noarch 1/1 Installed products updated. Verifying : mytop-1.7-3.b737f60.el6.noarch 1/1 Installed: mytop.noarch 0:1.7-3.b737f60.el6 Complete!
How do I use mytop command?
The syntax is as follows:
mytop -u DB-USERNAME -p DB-PASSWORD-HERE
In this example, connect using admin username and password as 123456:
$ mytop -u admin -p 123456
Sample outputs:

You can also specify a database name such as foobar to monitor:
$ mytop -u admin -p 123456 -d foobar
Finally, you can store this information in a config file called ~/.mytop file:
$ cat ~/.mytop
Sample outputs:
user=admin pass=123456 host=mysql0.hosting.some.com db=imail delay=10 port=3306 socket= batchmode=0 header=1 color=1 idle=1
mytop is capable of displaying a large amount of information and it supports lots of keyboard shortcut too, so be sure to read the man page and documentation of mtop.
Sincerely,
nixCfraft
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop













{ 0 comments… add one now }