How can I see how many MySQL connections are open?

前端 未结 5 1348
甜味超标
甜味超标 2020-12-12 20:35

How can I see how many connections have been opened during the current request via mysql_connect in PHP running on Apache?

I know that if I call m

5条回答
  •  旧巷少年郎
    2020-12-12 21:22

    I think there are a couple of ways:

    SHOW STATUS WHERE `variable_name` = 'Threads_connected'
    

    or you can do a SHOW PROCESSLIST and find out unique values in the Id column. In old PHP API mysql, there is mysql_list_processes function that does the same as SHOW PROCESSLIST, too.

    But first one should work for you. And perhaps you might like to check on other STATUS variables

提交回复
热议问题