What does 'show processlist' command do in MySQL?

MySQLMySQLi Database

The ‘SHOW processlist’ command can be used to display the running thread related to only your MySQL account. We can see almost all running threads if we have process privileges. It shows which threads are running.

The following is the query.

mysql> SHOW processlist;

Here is the output.

+----+-----------------+-----------------+------+---------+------+------------------------+------------------+
| Id | User            | Host            | db   | Command | Time | State                  | Info             |
+----+-----------------+-----------------+------+---------+------+------------------------+------------------+
|  4 | event_scheduler | localhost       | NULL | Daemon  |  968 | Waiting on empty queue | NULL             |
|  9 | root            | localhost:50255 | NULL | Query   |    0 | starting               | show processlist |
+----+-----------------+-----------------+------+---------+------+------------------------+------------------+
2 rows in set (0.00 sec)

If we change the database, then the output will be different, but there will always be the following two users: ‘event_scheduler’ and ‘root’.

Let us try the query again.

mysql> SHOW processlist;

The following is the output.

+----+-----------------+-----------------+----------+---------+------+------------------------+------------------+
| Id | User            | Host            | db       | Command | Time | State                  | Info             |
+----+-----------------+-----------------+----------+---------+------+------------------------+------------------+
|  4 | event_scheduler | localhost       | NULL     | Daemon  | 1148 | Waiting on empty queue | NULL             |
|  9 | root            | localhost:50255 | business | Query   |    0 | starting               | show processlist |
+----+-----------------+-----------------+----------+---------+------+------------------------+------------------+
2 rows in set (0.00 sec)
raja
Published on 20-Nov-2018 15:17:53
Advertisements