MySQL显示状态-活动或总连接数? [英] MySQL show status - active or total connections?
问题描述
当我运行show status like 'Con%'
时,它显示的连接数为9972,并且一直在增长.这是活动的连接数还是总共建立的连接数?
When I run show status like 'Con%'
it shows the number of connections, which is 9972 and constantly growing. Is this an active number of connections or connections made in total?
推荐答案
According to the docs, it means the total number throughout history:
Connections
Connections
与MySQL服务器的连接尝试次数(成功或失败).
The number of connection attempts (successful or not) to the MySQL server.
您可以通过Threads_connected
状态变量:
You can see the number of active connections either through the Threads_connected
status variable:
Threads_connected
Threads_connected
当前打开的连接数.
mysql> show status where `variable_name` = 'Threads_connected';
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| Threads_connected | 4 |
+-------------------+-------+
1 row in set (0.00 sec)
...或通过show processlist
命令:
mysql> show processlist;
+----+------+-----------------+--------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+------+-----------------+--------+---------+------+-------+------------------+
| 3 | root | localhost | webapp | Query | 0 | NULL | show processlist |
| 5 | root | localhost:61704 | webapp | Sleep | 208 | | NULL |
| 6 | root | localhost:61705 | webapp | Sleep | 208 | | NULL |
| 7 | root | localhost:61706 | webapp | Sleep | 208 | | NULL |
+----+------+-----------------+--------+---------+------+-------+------------------+
4 rows in set (0.00 sec)
这篇关于MySQL显示状态-活动或总连接数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!