show processlist展示的内容是从information_schema.processlist
数据表查询得到
所以可以使用SQL语句的条件查询进行过滤
mysql> desc information_schema.processlist; +---------+-----------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------+-----------------+------+-----+---------+-------+ | ID | bigint unsigned | NO | | | | | USER | varchar(32) | NO | | | | | HOST | varchar(261) | NO | | | | | DB | varchar(64) | YES | | | | | COMMAND | varchar(16) | NO | | | | | TIME | int | NO | | | | | STATE | varchar(64) | YES | | | | | INFO | varchar(65535) | YES | | | | +---------+-----------------+------+-----+---------+-------+ 8 rows in set (0.01 sec) mysql> select * from information_schema.processlist; +-----+-----------------+-----------------+------------+---------+-------+------------------------+----------------------------------------------+ | ID | USER | HOST | DB | COMMAND | TIME | STATE | INFO | +-----+-----------------+-----------------+------------+---------+-------+------------------------+----------------------------------------------+ | 120 | root | localhost:43378 | trading_db | Sleep | 45 | | NULL | | 121 | root | localhost | NULL | Query | 0 | executing | select * from information_schema.processlist | | 5 | event_scheduler | localhost | NULL | Daemon | 77571 | Waiting on empty queue | NULL | +-----+-----------------+-----------------+------------+---------+-------+------------------------+----------------------------------------------+ 3 rows in set (0.00 sec)