MySQL 显示状态 - 事件连接数还是总连接数?

标签 mysql connection

当我运行 show status like 'Con%' 时,它显示连接数,为 9972 个,并且在不断增长。这是活跃连接数还是总连接数?

最佳答案

根据the docs ,表示历史上的总数:

Connections

The number of connection attempts (successful or not) to the MySQL server.

您可以通过 Threads_connected 查看事件连接数状态变量:

Threads_connected

The number of currently open connections.

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 显示状态 - 事件连接数还是总连接数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46528139/

相关文章:

php - 使用 real_escape_string 时用户访问被拒绝

mysql - 我想按年龄过滤分组,年龄介于两者之间,并显示 0 计数之间未找到的数据

linux - 总数后 Git 卡住

java - 连接池

php - 将我的 Google Chart(表格)数据导出到 excel 或 csv

php - 无法连接到 Kohana 中的远程 MySql 服务器

c# - C# 安装项目的连接 UI.Dialog

android - android模拟器中的互联网连接

mysql - sql中如何进行嵌套排序?

connection - 我可以关闭ATS并将应用程序上传到App Store吗? -iOS 9