您可以使用SHOW VARIABLES命令显示当前配置变量。语法如下-
SHOW VARIABLES;
如果需要任何特定信息,请实施LIKE运算符。语法如下-
SHOW VARIABLES LIKE ‘%AnySpecificInformation%’;
现在我们将实现上述语法-
mysql> show variables like '%variable%';
以下是输出-
+--------------------------------+------------------------------------------------------------------------------------------+ | 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)
您还可以获取主机信息。查询如下-
mysql> show variables like '%host%';
以下是输出-
+-------------------------------+-----------------+ | Variable_name | Value | +-------------------------------+-----------------+ | host_cache_size | 279 | | hostname | DESKTOP-QN2RB3H | | performance_schema_hosts_size | -1 | | report_host | | +-------------------------------+-----------------+ 4 rows in set (0.00 sec)