Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> MySQL

Lệnh MySQL hiển thị biến cấu hình hiện tại

Dùng SHOW VARIABLES để xem biến cấu hình.

Cú pháp cơ bản:

SHOW VARIABLES;

Lọc thông tin cụ thể với LIKE:

SHOW VARIABLES LIKE '%AnySpecificInformation%';

Ví dụ tìm biến chứa "variable":

mysql> show variables like '%variable%';

Kết quả:

+--------------------------------+------------------------------------------------------------------------------------------+
| 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)

Lấy thông tin host:

mysql> show variables like '%host%';

Kết quả:

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