Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql: see all open connections to a given database?

Tags:

database

mysql

People also ask

How do I find MySQL connection list?

To get the list of connected users to MySQL Server, login to MySQL Server, and run the following SQL Query in mysql command line interface. SHOW PROCESSLIST; Now, as a test, we shall login using another username and run the above SQL Query again.

What is Threads_connected in MySQL?

Threads connected means the total number of client processes (threads) connected to the database server. This includes the count for threads running. Thread running means the total number of client processes (threads) currently executing on the database server.

What is show Processlist MySQL?

SHOW [FULL] PROCESSLIST. The MySQL process list indicates the operations currently being performed by the set of threads executing within the server. The SHOW PROCESSLIST statement is one source of process information. For a comparison of this statement with other sources, see Sources of Process Information.


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

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-variables or Too-many-connections-problem


That should do the trick for the newest MySQL versions:

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


You can invoke MySQL show status command

show status like 'Conn%';

For more info read Show open database connections


SQL: show full processlist;

This is what the MySQL Workbench does.


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

show status like 'Threads_connected';

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

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