mysql查看运行的进程
时间: 2023-02-07 10:01:17 浏览: 272
你可以使用 MySQL 的 `SHOW PROCESSLIST` 命令来查看当前服务器上正在运行的所有进程。运行这个命令之后,你会得到一个类似下面的结果:
```
mysql> SHOW PROCESSLIST;
+----+------+-----------+------+---------+------+----------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+------+-----------+------+---------+------+----------+------------------+
| 1 | root | localhost | NULL | Query | 0 | starting | SHOW PROCESSLIST |
+----+------+-----------+------+---------+------+----------+------------------+
```
这个命令会显示所有正在运行的进程的 ID、用户名、主机名、数据库名、当前状态以及执行的命令。
你也可以使用 `mysqladmin` 命令来查看进程,例如:
```
$ mysqladmin processlist
+----+------+-----------+------+---------+------+----------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+------+-----------+------+---------+------+----------+------------------+
| 1 | root | localhost | NULL | Query | 0 | starting | SHOW PROCESSLIST |
+----+------+-----------+------+---------+------+----------+------------------+
```
阅读全文