Skip to content

List active connection details in MariaDB

To list active connections and their details in MariaDB we can use the following queries.

Advertisements

Using threads_connected

show status where variable_name = 'threads_connected';


|Variable_name    |Value|
|-----------------|-----|
|Threads_connected|10   |

Using processlist

show processlist;


|Id |User     |Host                |db    |Command|Time|State|Info            |Progress|
|---|---------|--------------------|------|-------|----|-----|----------------|--------|
|18 |developer|192.30.0.8:52222    |      |Sleep  |31  |     |                |0.0     |
|19 |developer|192.30.0.8:52224    |      |Sleep  |31  |     |                |0.0     |
|20 |developer|192.30.0.8:52226    |      |Sleep  |31  |     |                |0.0     |
|21 |developer|192.30.0.8:52228    |      |Sleep  |31  |     |                |0.0     |
|22 |developer|192.30.0.8:52230    |      |Sleep  |31  |     |                |0.0     |
|23 |developer|192.30.0.8:52232    |      |Sleep  |31  |     |                |0.0     |
|24 |developer|192.30.0.8:52234    |      |Sleep  |31  |     |                |0.0     |
|25 |developer|192.30.0.8:52236    |      |Sleep  |31  |     |                |0.0     |
|26 |developer|192.30.0.8:52238    |      |Sleep  |31  |     |                |0.0     |
|27 |developer|192.30.0.8:52240    |      |Sleep  |31  |     |                |0.0     |
|28 |developer|157.76.116.233:47868|pcodea|Sleep  |15  |     |                |0.0     |
|29 |developer|157.76.116.233:47870|pcodea|Sleep  |13  |     |                |0.0     |
|30 |developer|157.76.116.233:47872|pcodea|Query  |0   |Init |show processlist|0.0     |

Using information_schema.processlist

Advertisements
select id, user, host, db, command, time, state, info, progress
from information_schema.processlist;


|Id |User     |Host                |db    |Command|Time|State|Info            |Progress|
|---|---------|--------------------|------|-------|----|-----|----------------|--------|
|18 |developer|192.30.0.8:52222    |      |Sleep  |31  |     |                |0.0     |
|19 |developer|192.30.0.8:52224    |      |Sleep  |31  |     |                |0.0     |
|20 |developer|192.30.0.8:52226    |      |Sleep  |31  |     |                |0.0     |
|21 |developer|192.30.0.8:52228    |      |Sleep  |31  |     |                |0.0     |
|22 |developer|192.30.0.8:52230    |      |Sleep  |31  |     |                |0.0     |
|23 |developer|192.30.0.8:52232    |      |Sleep  |31  |     |                |0.0     |
|24 |developer|192.30.0.8:52234    |      |Sleep  |31  |     |                |0.0     |
|25 |developer|192.30.0.8:52236    |      |Sleep  |31  |     |                |0.0     |
|26 |developer|192.30.0.8:52238    |      |Sleep  |31  |     |                |0.0     |
|27 |developer|192.30.0.8:52240    |      |Sleep  |31  |     |                |0.0     |
|28 |developer|157.76.116.233:47868|pcodea|Sleep  |15  |     |                |0.0     |
|29 |developer|157.76.116.233:47870|pcodea|Sleep  |13  |     |                |0.0     |
|30 |developer|157.76.116.233:47872|pcodea|Query  |0   |Init |show processlist|0.0     |

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.