Syntax error MySQL status in terms of active or total connections?

MySQL status in terms of active or total connections?



The active or total connection can be known with the help of threads_connected variable. The variable tells about the number of currently open connections.

The query is as follows −

mysql> show status where `variable_name` = 'Threads_connected';

Here is the output.

+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| Threads_connected | 1     |
+-------------------+-------+
1 row in set (0.06 sec)

We can check the same with the help of show command. The query is as follows −

mysql> show processlist;

Here is the output.

+----+-----------------+-----------------+----------+---------+--------+------------------------+------------------+
| Id | User            | Host            | db       | Command | Time   | State                  | Info             |
+----+-----------------+-----------------+----------+---------+--------+------------------------+------------------+
|  4 | event_scheduler | localhost       | NULL     | Daemon  | 349012 | Waiting on empty queue | NULL             |
| 11 | root            | localhost:54746 | business | Query   |      1 | starting               | show processlist |
+----+-----------------+-----------------+----------+---------+--------+------------------------+------------------+
2 rows in set (0.31 sec)
Updated on: 2019-07-30T22:30:23+05:30

8K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements