Eduardo Medeiros

Eduardo Medeiros

System Engineer.

© 2022

About me

Browse by categories

MariaDB: How-to check connections and threads connected

Sometimes we have to do some troubleshooting inside our database environment such as checking the current connections and threads for instance. The number of connections and threads are good indicators for capacity planning as well. In this post, I will show some commands to get that information.

Getting the current settings:

MariaDB [(none)]> show global variables like 'max_connections';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 200 |
+-----------------+-------+
1 row in set (0.00 sec)
MariaDB [(none)]> show global variables like 'thread_pool_max_threads';
+-------------------------+-------+
| Variable_name | Value |
+-------------------------+-------+
| thread_pool_max_threads | 200 |
+-------------------------+-------+
1 row in set (0.00 sec)

Checking the current status:

MariaDB [(none)]> show status where `variable_name` = 'Max_used_connections';
MariaDB [(none)]> show status where `variable_name` = 'Threads_connected';