mysql:查看到给定数据库的所有打开的连接?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1620662/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 14:21:03  来源:igfitidea点击:

mysql: see all open connections to a given database?

mysqldatabase

提问by flybywire

With administrative permissions im mysql, how can I see all the open connections to a specific db in my server?

使用 mysql 管理权限,如何查看服务器中特定数据库的所有打开连接?

回答by David Rabinowitz

The command is

命令是

SHOW PROCESSLIST

Unfortunately, it has no narrowing parameters. If you need them you can do it from the command line:

不幸的是,它没有缩小参数。如果您需要它们,您可以从命令行执行此操作:

mysqladmin processlist | grep database-name

回答by wiseland

As well you can use:

您也可以使用:

mysql> show status like '%onn%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| Aborted_connects         | 0     |
| Connections              | 303   |
| Max_used_connections     | 127   |
| Ssl_client_connects      | 0     |
| Ssl_connect_renegotiates | 0     |
| Ssl_finished_connects    | 0     |
| Threads_connected        | 127   |
+--------------------------+-------+
7 rows in set (0.01 sec)

Feel free to use Mysql-server-status-variablesor Too-many-connections-problem

随意使用 Mysql-server-status-variablesToo-many-connections-problem

回答by Vadym Tyemirov

That should do the trick for the newest MySQL versions:

这应该适用于最新的 MySQL 版本:

SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE DB = "elstream_development";

SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE DB = "elstream_development";

回答by adatapost

You can invoke MySQL show status command

您可以调用 MySQL show status 命令

show status like 'Conn%';

显示状态如 'Conn%';

For more info read Show open database connections

有关更多信息,请阅读显示打开的数据库连接

回答by justAMySQL_starter

SQL: show full processlist;

SQL:显示完整的进程列表;

This is what the MySQL Workbench does.

这就是 MySQL Workbench 所做的。

回答by Ayan

In MySql,the following query shall show the total number of open connections:

在 MySql 中,以下查询将显示打开的连接总数:

show status like 'Threads_connected';

回答by Pryo

If you're running a *nix system, also consider mytop.

如果您正在运行 *nix 系统,还可以考虑mytop

To limit the results to one database, press "d" when it's running then type in the database name.

要将结果限制为一个数据库,请在运行时按“d”,然后输入数据库名称。

回答by Kanagaraj M

In query browser right click on database and select processlist

在查询浏览器中右键单击数据库并选择进程列表