What SQL statement to show the maximum number of active connections to the MySQL database?

5

What SQL command returns the number of active connections to the database?

    
asked by anonymous 04.09.2015 / 19:48

4 answers

4

Another option to view the connections is:

SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
    
04.09.2015 / 22:19
7
SHOW VARIABLES;

Documentation .

    
04.09.2015 / 19:50
5

To list all bank statuses, type:

SHOW STATUS;

And to get execution events, including the very one below:

SHOW STATUS where Variable_name='Com_show_status'; 

To get connection status only:

SHOW STATUS where Variable_name like '%connect%';
    
04.09.2015 / 19:57
4

What is the SQL statement to show the maximum number of active connections ( possible ) in MySql?

select @@max_connections;

@@ max_connections is a global variable.

Now if you want to know how many connections are active it would look like this:

SHOW STATUS WHERE 'variable_name' = 'Threads_connected';

I'll leave a bonus on the answer, it has the command show processlist which is a much used command too.

    
04.09.2015 / 19:52