MySQL tutorial: SHOW STATUS [EN]
top of page
CerebroSQL

MySQL: 

SHOW STATUS

Syntax:
SHOW [GLOBAL | SESSION] STATUS
[LIKE 'pattern' | WHERE expr]

SHOW STATUS provides server status information.
This statement does not require any privilege. It requires only the
ability to connect to the server.

Status variable information is also available from these sources:

o Performance Schema tables.

o The mysqladmin extended-status command.

For SHOW STATUS, a LIKE clause, if present, indicates which variable
names to match. A WHERE clause can be given to select rows using more
general conditions.

SHOW STATUS accepts an optional GLOBAL or SESSION variable scope
modifier:

o With a GLOBAL modifier, the statement displays the global status
values. A global status variable may represent status for some aspect
of the server itself (for example, Aborted_connects), or the
aggregated status over all connections to MySQL (for example,
Bytes_received and Bytes_sent). If a variable has no global value,
the session value is displayed.

o With a SESSION modifier, the statement displays the status variable
values for the current connection. If a variable has no session
value, the global value is displayed. LOCAL is a synonym for SESSION.

o If no modifier is present, the default is SESSION.

The scope for each status variable is listed at
https://dev.mysql.com/doc/refman/8.0/en/server-status-variables.html.

Each invocation of the SHOW STATUS statement uses an internal temporary
table and increments the global Created_tmp_tables value.

With a LIKE clause, the statement displays only rows for those
variables with names that match the pattern:

mysql> SHOW STATUS LIKE 'Key%';
+--------------------+----------+
| Variable_name | Value |
+--------------------+----------+
| Key_blocks_used | 14955 |
| Key_read_requests | 96854827 |
| Key_reads | 162040 |
| Key_write_requests | 7589728 |
| Key_writes | 3813196 |
+--------------------+----------+

Example

bottom of page