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

发布于 2024-12-04 18:16:14 字数 89 浏览 1 评论 0原文

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

山人契 2024-12-11 18:16:15

你也可以做

SHOW STATUS WHERE `variable_name` = 'Max_used_connections';

You can also do

SHOW STATUS WHERE `variable_name` = 'Max_used_connections';
暮色兮凉城 2024-12-11 18:16:15

这是到目前为止与服务器的连接总数。
要查找当前的连接状态,您可以使用

mysqladmin -u -p 扩展状态 | grep -wi
'threads_connected\|threads_running' | 'threads_connected\|threads_running' | awk '{ print $2,$4}'

这将向您显示:

Threads_connected 12

Threads_running 1  

Threads_connected: Number of connections

Threads_running: connections currently running some sql

This is the total number of connections to the server till now.
To find current conection status you can use

mysqladmin -u -p extended-status | grep -wi
'threads_connected\|threads_running' | awk '{ print $2,$4}'

This will show you:

Threads_connected 12

Threads_running 1  

Threads_connected: Number of connections

Threads_running: connections currently running some sql
歌枕肩 2024-12-11 18:16:15

要查看更完整的列表,您可以运行:

show session status;

show global status;

参见 this链接以更好地了解用法。

如果您想了解有关数据库的详细信息,可以运行:

status;

To see a more complete list you can run:

show session status;

or

show global status;

See this link to better understand the usage.

If you want to know details about the database you can run:

status;
少女七分熟 2024-12-11 18:16:15

为了检查允许的最大连接数,您可以运行以下查询:

SHOW VARIABLES LIKE "max_connections";

要检查自服务器启动以来同时使用的最大连接数:

SHOW VARIABLES LIKE "max_used_connections";

要检查活动连接数,请使用:

SHOW processlist;

SHOW status WHERE `variable_name` = 'Threads_connected';

Hope it有帮助。

In order to check the maximum allowed connections, you can run the following query:

SHOW VARIABLES LIKE "max_connections";

To check the number of the maximum number of connections that have been in use simultaneously since the server started:

SHOW VARIABLES LIKE "max_used_connections";

To check the number of active connections, use:

SHOW processlist;

or

SHOW status WHERE `variable_name` = 'Threads_connected';

Hope it helps.

稀香 2024-12-11 18:16:15

根据文档 http://dev.mysql。 com/doc/refman/5.0/en/server-status-variables.html#statvar_Connections

连接

尝试连接 MySQL 服务器的次数(成功或失败)。

As per doc http://dev.mysql.com/doc/refman/5.0/en/server-status-variables.html#statvar_Connections

Connections

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

时光沙漏 2024-12-11 18:16:15

它应该是当前的活动连接数。运行命令 processlist 进行确认。

参考网址:http://www. devdaily.com/blog/post/mysql/how-show-open-database-connections-mysql

编辑:打开的数据库连接数请看这里,实际的线程(连接)数是描述在这里!

It should be the current number of active connections. Run the command processlist to make sure.

URL for reference: http://www.devdaily.com/blog/post/mysql/how-show-open-database-connections-mysql

EDIT: Number of DB connections opened Please take a look here, the actual number of threads (connections) are described here!

我的鱼塘能养鲲 2024-12-11 18:16:14

根据 文档,这意味着历史上的总数:

连接

尝试连接 MySQL 服务器的次数(成功或失败)。

您可以通过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)

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

Connections

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

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

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)

... 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)
横笛休吹塞上声 2024-12-11 18:16:14
SHOW STATUS WHERE `variable_name` = 'Threads_connected';

这将向您显示所有打开的连接。

SHOW STATUS WHERE `variable_name` = 'Threads_connected';

This will show you all the open connections.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文