Show MySQL thread and connection counters
Build a paste-ready command, then review its compatibility and effects before running it.
mysql -h <host> -e "show global status where Variable_name in ('Threads_connected','Threads_running','Max_used_connections');"Complete required fields to copy the generated command.
Compatibility
LinuxVerified for Linux using posix, bash, zsh syntax.
Operational knowledgereview due 2027-01-20
Requirementsmysqlmysql must be installed and available on PATH.Network accessThe target must be reachable from the current environment.
Version supportmysql Current supported releasesVerified for linux using posix, bash, zsh syntax; consult compatibility notes for platform-specific differences.
Expected signalsVariable_name ValueRepresentative successful output; values vary with the selected target and system state.
Known errorsmysql: command not foundmysql is missing or is not available on PATH.
Verifymysql -h {{host}} -e "show global status where Variable_name in ('Threads_connected','Threads_running','Max_used_connections');"The output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01mysqlCommandRuns the mysql stage of this one-liner.
02-hOptionRequests human-readable units or command help, depending on the tool.
03<host>ParameterA value supplied in the Fill parameters section.
04-eOptionConfigures mysql with the -e option.
05"show global status where Variable_name in ('Threads_connected','Threads_running','Max_used_connections');"ArgumentPasses "show global status where Variable_name in ('Threads_connected','Threads_running','Max_used_connections');" to mysql.
Example input
mysql -h example.com -e "show global status where Variable_name in ('Threads_connected','Threads_running','Max_used_connections');"
Example output
Variable_name Value
Max_used_connections 42
Threads_connected 18
Threads_running 3
Illustrative output — exact values vary by system and data.
Official sources