MySQL command for display current configuration variables?


You can use SHOW VARIABLES command to display current configuration variables. The syntax is as follows −

SHOW VARIABLES;

If you want any specific information, then implement the LIKE operator. The syntax is as follows −

SHOW VARIABLES LIKE ‘%AnySpecificInformation%’;

Now we will implement the above syntax −

mysql> show variables like '%variable%';

The following is the output −

+--------------------------------+------------------------------------------------------------------------------------------+
| Variable_name                  | Value                                                                                    |
+--------------------------------+------------------------------------------------------------------------------------------+
| session_track_system_variables | time_zone,autocommit,character_set_client,character_set_results,character_set_connection |
+--------------------------------+------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)

You can also get the host information. The query is as follows −

mysql> show variables like '%host%';

The following is the output −

+-------------------------------+-----------------+
| Variable_name                 | Value           |
+-------------------------------+-----------------+
| host_cache_size               | 279             |
| hostname                      | DESKTOP-QN2RB3H |
| performance_schema_hosts_size | -1              |
| report_host                   |                 |
+-------------------------------+-----------------+
4 rows in set (0.00 sec)

Updated on: 29-Jun-2020

179 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements