Name

SHOW VARIABLES

Synopsis

SHOW [GLOBAL|SESSION] VARIABLES [LIKE 'pattern']

This statement displays the system variables for the MySQL server. The SESSION flag will display values for current sessions or connections. This is the default and is synonymous with LOCAL. The GLOBAL flag will provide variables that will relate to new connections. You can limit the variables with the LIKE clause and a naming pattern for the variables. Here is an example of this statement:

SHOW VARIABLES LIKE 'version%';
+-------------------------+--------------------+
| Variable_name           | Value              |
+-------------------------+--------------------+
| version                 | 4.1.7-standard-log |
| version_comment         | Official MySQL RPM |
| version_compile_machine | i686               |
| version_compile_os      | pc-linux           |
+-------------------------+--------------------+

In this example, the variables shown are limited to variable names beginning with the word “version.”

Get MySQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.