打开的DB连接数

时间:2009-05-05 11:18:23

标签: mysql

在MYSQL 5.0中,任何人都可以知道如何获得正在使用的数据库连接

3 个答案:

答案 0 :(得分:23)

SHOW STATUS WHERE variable_name = 'Threads_connected'

答案 1 :(得分:3)

12.5.5.31. SHOW PROCESSLIST Syntax

显示连接服务器的人数。

答案 2 :(得分:2)

Number of open connections can be found out by using below query:
   mysql -e 'SHOW STATUS WHERE variable_name LIKE "Threads_%" OR variable_name = "Connections"'

   +-------------------+-------+
   | Variable_name     | Value |
   +-------------------+-------+
   | Connections       | 862   |
   | Threads_cached    | 0     |
   | Threads_connected | 10    |
   | Threads_created   | 26    |
   | Threads_running   | 1     |
   +-------------------+-------+