Bootstrap FreeKB - mySQL / MariaDB - List active connections
mySQL / MariaDB - List active connections

Updated:   |  mySQL / MariaDB articles

This assume you are able to log into your MariaDB or mySQL server or you have configured passwordless authentication and will be using the -e command line option.

The show status command will contain key value pairs. The output should start with something like this.

~]$ mysql -e "show status"
Variable_name   Value
Aborted_clients 16
Aborted_connects        1676
Aborted_connects_preauth        286

 

The threads_connected is probably a good place to start.

~]$ mysql -e "show status where variable_name = 'threads_connected'"
Variable_name   Value
Threads_connected       2

 

The show processlist can also be useful to get a better idea of the active connections. Notice in this example the connection from john.doe from the system with IP address 10.13.59.27 has a time of 20 (seconds). This might be suggestive of a problem. Perhaps this connection is coming from an app that is missing logic to close the connection.

~]$ mysql -e "show processlist \G"
*************************** 4. row ***************************
      Id: 11735
    User: john.doe
    Host: 10.13.59.27:38162
      db: mydb
 Command: Sleep
    Time: 20
   State:
    Info: NULL
Progress: 0.000

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter c3d6ff in the box below so that we can be sure you are a human.