MySQL 在活动或总连接方面的状态是什么?


活动或总连接可以通过 threads_connected 变量了解。该变量说明了当前的打开连接数。

查询如下 −

mysql> show status where `variable_name` = 'Threads_connected';

输出如下。

+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| Threads_connected | 1     |
+-------------------+-------+
1 row in set (0.06 sec)

我们可以通过 show 命令查看相同的内容。查询如下 −

mysql> show processlist;

输出如下。

+----+-----------------+-----------------+----------+---------+--------+------------------------+------------------+
| Id | User            | Host            | db       | Command | Time   | State                  | Info             |
+----+-----------------+-----------------+----------+---------+--------+------------------------+------------------+
|  4 | event_scheduler | localhost       | NULL     | Daemon  | 349012 | Waiting on empty queue | NULL             |
| 11 | root            | localhost:54746 | business | Query   |      1 | starting               | show processlist |
+----+-----------------+-----------------+----------+---------+--------+------------------------+------------------+
2 rows in set (0.31 sec)

更新于:30-Jul-2019

7K+ 视图

开启你的职业生涯

完成课程获得认证

开始学习
广告