SHOW STATUS 'Con%' 是否顯示活動或總 MySQL 連線?

DDD
發布: 2024-11-15 08:18:02
原創
300 人瀏覽過

Does SHOW STATUS 'Con%' Display Active or Total MySQL Connections?

Understanding MySQL Connection Counts with SHOW STATUS

When running SHOW STATUS LIKE 'Con%', the output displays an ever-increasing number of connections. This raises the question: does this value represent active connections or the total number of connections established throughout the server's history?

The MySQL documentation clarifies that the number refers to the total number of connection attempts, both successful and unsuccessful, over the entire lifetime of the server:

Connections: The number of connection attempts (successful or not) to the MySQL server.
登入後複製

Identifying Active Connections

To view the number of active connections, use either the Threads_connected status variable or the SHOW PROCESSLIST command:

  • Threads_connected:
SHOW STATUS WHERE `variable_name` = 'Threads_connected';
登入後複製
  • SHOW PROCESSLIST:
SHOW PROCESSLIST;
登入後複製

These commands will provide an up-to-date count of active MySQL connections.

以上是SHOW STATUS 'Con%' 是否顯示活動或總 MySQL 連線?的詳細內容。更多資訊請關注PHP中文網其他相關文章!

來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板