📣
TiDB Cloud Premium 开放公测中。为企业级工作负载提供无限扩展、即时弹性伸缩和高级安全保障。此页面由 AI 自动翻译,英文原文请见此处。

SHOW [GLOBAL|SESSION] VARIABLES



This statement shows a list of variables for the scope of either GLOBAL or SESSION. If no scope is specified, the default scope of SESSION will apply.

Synopsis

ShowVariablesStmt
SHOWGLOBALSESSIONVARIABLESShowLikeOrWhere
ShowLikeOrWhere
LIKESimpleExprWHEREExpression

Examples

以下示例演示了如何使用 SHOW [GLOBAL|SESSION] VARIABLES 语句显示名称或值匹配特定模式的变量。有关这些变量的详细说明,请参见 System Variables

mysql> SHOW GLOBAL VARIABLES LIKE 'tidb_stmt_summary%'; +-------------------------------------+---------------------+ | Variable_name | Value | +-------------------------------------+---------------------+ | tidb_stmt_summary_enable_persistent | OFF | | tidb_stmt_summary_file_max_backups | 0 | | tidb_stmt_summary_file_max_days | 3 | | tidb_stmt_summary_file_max_size | 64 | | tidb_stmt_summary_filename | tidb-statements.log | | tidb_stmt_summary_history_size | 24 | | tidb_stmt_summary_internal_query | OFF | | tidb_stmt_summary_max_sql_length | 4096 | | tidb_stmt_summary_max_stmt_count | 3000 | | tidb_stmt_summary_refresh_interval | 1800 | +-------------------------------------+---------------------+ 10 rows in set (0.001 sec) mysql> SHOW GLOBAL VARIABLES LIKE 'time_zone%'; +---------------+--------+ | Variable_name | Value | +---------------+--------+ | time_zone | SYSTEM | +---------------+--------+ 1 row in set (0.00 sec) mysql> SHOW VARIABLES WHERE Variable_name="tidb_window_concurrency"; +-------------------------+-------+ | Variable_name | Value | +-------------------------+-------+ | tidb_window_concurrency | -1 | +-------------------------+-------+ 1 row in set (0.00 sec) mysql> SHOW VARIABLES WHERE Value=300; +--------------------------------+-------+ | Variable_name | Value | +--------------------------------+-------+ | ddl_slow_threshold | 300 | | delayed_insert_timeout | 300 | | innodb_purge_batch_size | 300 | | key_cache_age_threshold | 300 | | slave_checkpoint_period | 300 | | tidb_slow_log_threshold | 300 | | tidb_wait_split_region_timeout | 300 | +--------------------------------+-------+ 7 rows in set (0.00 sec)

MySQL compatibility

The SHOW [GLOBAL|SESSION] VARIABLES statement in TiDB is fully compatible with MySQL. If you find any compatibility differences, report a bug.

See also

文档内容是否有帮助?