如何查看MySQL当前连接数

Posted 翔云

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何查看MySQL当前连接数相关的知识,希望对你有一定的参考价值。

mysql中,连接建立后,会分配一个线程负责。一个连接,就是一个线程。

可以通过查看MySQL状态参数,查看当前的连接数:

mysql> show status like ‘Threads%‘;
+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| Threads_cached    | 9     |
| Threads_connected | 1     |
| Threads_created   | 3911  |
| Threads_running   | 1     |
+-------------------+-------+
4 rows in set (0.00 sec)

其中,Threads_connected就是当前连接数。

以上是关于如何查看MySQL当前连接数的主要内容,如果未能解决你的问题,请参考以下文章