MySQL 显示状态 - 活动连接数还是总连接数?

MySQL show status - active or total connections?(MySQL 显示状态 - 活动连接数还是总连接数?)
本文介绍了MySQL 显示状态 - 活动连接数还是总连接数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行 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?

推荐答案

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

According to the docs, it means the total number throughout history:

连接

连接到 MySQL 服务器的尝试次数(成功与否).

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

您可以通过活动连接的数量.html#statvar_Threads_connected" rel="noreferrer">Threads_connected 状态变量:

You can see the number of active connections either through the Threads_connected status variable:

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 命令:

... or through the show processlist command:

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 显示状态 - 活动连接数还是总连接数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Hibernate reactive No Vert.x context active in aws rds(AWS RDS中的休眠反应性非Vert.x上下文处于活动状态)
Bulk insert with mysql2 and NodeJs throws 500(使用mysql2和NodeJS的大容量插入抛出500)
Flask + PyMySQL giving error no attribute #39;settimeout#39;(FlASK+PyMySQL给出错误,没有属性#39;setTimeout#39;)
auto_increment column for a group of rows?(一组行的AUTO_INCREMENT列?)
Sort by ID DESC(按ID代码排序)
SQL/MySQL: split a quantity value into multiple rows by date(SQL/MySQL:按日期将数量值拆分为多行)