你可以使用 show status 查看当前连接数。
mysql> show status where `variable_name` = 'Threads_connected';
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| Threads_connected | 1 |
+-------------------+-------+
1 row in set (0.00 sec)
或者 show processlist
mysql> show processlist;
+----+------+-----------------+-------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+------+-----------------+---------------+---------+------+-------+------------------+
| 1 | root | localhost | NULL | Query | 0 | init | show processlist |
| 3 | root | 127.0.0.1:50608 | users | Sleep | 2 | | NULL |
+----+------+-----------------+-------+---------+------+-------+------------------+
2 rows in set (0.00 sec)