What SQL command shows the maximum number of active connections to the Mysql database?

Asked

Viewed 6,626 times

5

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

  • 1

    You chose another answer to accept because she’s better or you’re jumping from one to the other because you don’t know you can only accept one of them and when you choose one, you’re taking it from the other?

4 answers

7

  • Thank you very much !

5

To list all bank status, type:

SHOW STATUS;

And to pick up running events, including the one below:

SHOW STATUS where Variable_name='Com_show_status'; 

To get only connection status:

SHOW STATUS where Variable_name like '%connect%';

4

What is the SQL command to display the number maximum of active connections(possible) in Mysql?

select @@max_connections;

@@max_connections is a global variable.

Now if you wanna know how many connections are active would be so:

SHOW STATUS WHERE `variable_name` = 'Threads_connected';

I’ll leave a bonus on the answer, you have the command show processlist which is a very used command too.

  • 2

    This command show processlist is also very useful when you want to kill some process that is lagging the server, through the command: Kill [id_do_process];

4


Another option to display connections is:

SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST

Browser other questions tagged

You are not signed in. Login or sign up in order to post.