English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

What does the 'show processlist' command do in MySQL?

The 'SHOW processlist' command can be used to display only the running threads related to your MySQL account. If we have process privileges, we can almost see all running threads. It shows which threads are running.

The following is the query.

mysql> SHOW processlist;

This 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, the output will be different, but there will always be the following two users: 'event_scheduler' and 'root'.

Let's 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)