Getting MySQL System Variables

Last modified: 
Thursday, October 22nd, 2015
Topics: 
MySQL

List all system variables

SHOW VARIABLES\G

Get the value of a global system variable

SELECT @@global.slow_query_log;
+-------------------------+
| @@global.slow_query_log |
+-------------------------+
|                       0 |
+-------------------------+

Get the value of a system session variable

SELECT @@session.big_tables;
+----------------------+
| @@session.big_tables |
+----------------------+
|                    0 |
+----------------------+
1 row in set (0.00 sec)

Get multiple system variable values

SELECT @@global.time_format, @@global.lock_wait_timeout, @@global.aria_page_checksum;;
+----------------------+----------------------------+-----------------------------+
| @@global.time_format | @@global.lock_wait_timeout | @@global.aria_page_checksum |
+----------------------+----------------------------+-----------------------------+
| %H:%i:%s             |                   31536000 |                           1 |
+----------------------+----------------------------+-----------------------------+
1 row in set (0.00 sec)

References


The operator of this site makes no claims, promises, or guarantees of the accuracy, completeness, originality, uniqueness, or even general adequacy of the contents herein and expressly disclaims liability for errors and omissions in the contents of this website.