How to check mysql process list on a cPanel server:

There are different ways for checking mysql process list from a cPanel server. As you all know for most of the production server it is needed to check mysql process list for checking the currently running queries and for finding slow queries that slow down the website loading speed.

You can check MySQL process list from command line in the following ways,

Enter into mysql from command line using the command,

mysql

After that use the command,

show processlist;

For example:

root@iserver2 [~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1165608
Server version: 5.5.42-cll MySQL Community Server (GPL)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show processlist;

+---------+----------------+-----------+----------------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+---------+----------------+-----------+----------------+---------+------+-------+------------------+
| 70 | eximstats | localhost | eximstats | Sleep | 6 | | NULL |
| 1158461 | leechprotect | localhost | leechprotect | Sleep | 5369 | | NULL |
| 1163624 | modsec | localhost | modsec | Sleep | 7 | | NULL |
| 1165608 | root | localhost | NULL | Query | 0 | NULL | show processlist |
| 1165613 | maxmind_wdps1 | localhost | maxmind_wdps1 | Sleep | 0 | | NULL |
+---------+----------------+-----------+----------------+---------+------+-------+------------------+
5 rows in set (0.00 sec)
mysql>

Another method from command line is to display the results of process list during a particular interval of time. For example to display process on an interval of 4 seconds user the command,

mysqladmin -i 4 processlist

It will display as,

root@iserver2 [~]# mysqladmin -i 4 processlist
+---------+--------------+-----------+--------------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+---------+--------------+-----------+--------------+---------+------+-------+------------------+
| 70 | eximstats | localhost | eximstats | Sleep | 28 | | |
| 1158461 | leechprotect | localhost | leechprotect | Sleep | 5521 | | |
| 1163624 | modsec | localhost | modsec | Sleep | 2 | | |
| 1165806 | root | localhost | | Query | 0 | | show processlist |
+---------+--------------+-----------+--------------+---------+------+-------+------------------+
+---------+--------------+-----------+--------------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+---------+--------------+-----------+--------------+---------+------+-------+------------------+
| 70 | eximstats | localhost | eximstats | Sleep | 32 | | |
| 1158461 | leechprotect | localhost | leechprotect | Sleep | 5525 | | |
| 1163624 | modsec | localhost | modsec | Sleep | 1 | | |
| 1165806 | root | localhost | | Query | 0 | | show processlist |

You can change the interval of time in seconds by changing the number next to -i on the command. It denotes the recurring seconds.

That’s it

If you need our help to fix any issues on your server. Please feel free to contact us, simply email to support@iserversupport.com

Monthly server support with Unlimited tickets, 24×7 monitoring, Security Audit and lot more for just $59