Home > Database > Mysql Tutorial > Does SHOW STATUS 'Con%' Display Active or Total MySQL Connections?

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

DDD
Release: 2024-11-15 08:18:02
Original
363 people have browsed it

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.
Copy after login

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';
Copy after login
  • SHOW PROCESSLIST:
SHOW PROCESSLIST;
Copy after login

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

The above is the detailed content of Does SHOW STATUS 'Con%' Display Active or Total MySQL Connections?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template