From 3a6cc5307120c977d9663e944bba757081526d86 Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Wed, 17 Jun 2020 11:54:09 +0800 Subject: [PATCH] cherry pick #2863 to release-4.0 Signed-off-by: ti-srebot --- TOC.md | 1 + sql-statements/sql-statement-show-config.md | 90 +++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 sql-statements/sql-statement-show-config.md diff --git a/TOC.md b/TOC.md index c42810781d951..31442104ad26c 100644 --- a/TOC.md +++ b/TOC.md @@ -263,6 +263,7 @@ + [`SHOW CHARACTER SET`](/sql-statements/sql-statement-show-character-set.md) + [`SHOW COLLATION`](/sql-statements/sql-statement-show-collation.md) + [`SHOW [FULL] COLUMNS FROM`](/sql-statements/sql-statement-show-columns-from.md) + + [`SHOW CONFIG`](/sql-statements/sql-statement-show-config.md) + [`SHOW CREATE SEQUENCE`](/sql-statements/sql-statement-show-create-sequence.md) + [`SHOW CREATE TABLE`](/sql-statements/sql-statement-show-create-table.md) + [`SHOW CREATE USER`](/sql-statements/sql-statement-show-create-user.md) diff --git a/sql-statements/sql-statement-show-config.md b/sql-statements/sql-statement-show-config.md new file mode 100644 index 0000000000000..601a930693bc3 --- /dev/null +++ b/sql-statements/sql-statement-show-config.md @@ -0,0 +1,90 @@ +--- +title: SHOW CONFIG +summary: Overview of the use of SHOW CONFIG in the TiDB database +category: reference +--- + +# SHOW CONFIG + +> **Warning:** +> +> This feature is currently an experimental feature. It is not recommended to use this feature in the production environment. + +The `SHOW CONFIG` statement is used to show the current configuration of various components of TiDB. Note that the configuration and system variables act on different dimensions and should not be mixed up. If you want to obtain the system variable information, use the [SHOW VARIABLES](/sql-statements/sql-statement-show-variables.md) syntax. + +## Synopsis + +**ShowStmt:** + +![ShowStmt](/media/sqlgram/ShowStmt.png) + +**ShowTargetFilterable:** + +![ShowTargetFilterable](/media/sqlgram/ShowTargetFilterable.png) + +## Examples + +Show all configurations: + +{{< copyable "sql" >}} + +```sql +SHOW CONFIG; +``` + +``` ++------+----------------+-------------------------------------------------+---------------------------------------------------------------------+ +| Type | Instance | Name | Value | ++------+----------------+-------------------------------------------------+---------------------------------------------------------------------+ +| tidb | 127.0.0.1:4000 | advertise-address | 127.0.0.1 | +| tidb | 127.0.0.1:4000 | alter-primary-key | false | +| tidb | 127.0.0.1:4000 | binlog.binlog-socket | | +| tidb | 127.0.0.1:4000 | binlog.enable | false | +... +120 rows in set (0.01 sec) +``` + +Show the configuration where the `type` is `tidb`: + +{{< copyable "sql" >}} + +```sql +SHOW CONFIG WHERE type = 'tidb' AND name = 'advertise-address'; +``` + +``` ++------+----------------+-------------------+-----------+ +| Type | Instance | Name | Value | ++------+----------------+-------------------+-----------+ +| tidb | 127.0.0.1:4000 | advertise-address | 127.0.0.1 | ++------+----------------+-------------------+-----------+ +1 row in set (0.05 sec) +``` + +You can also use the `LIKE` clause to show the configuration where the `type` is `tidb`: + +{{< copyable "sql" >}} + +```sql +SHOW CONFIG LIKE 'tidb'; +``` + +``` ++------+----------------+-------------------------------------------------+---------------------------------------------------------------------+ +| Type | Instance | Name | Value | ++------+----------------+-------------------------------------------------+---------------------------------------------------------------------+ +| tidb | 127.0.0.1:4000 | advertise-address | 127.0.0.1 | +| tidb | 127.0.0.1:4000 | alter-primary-key | false | +| tidb | 127.0.0.1:4000 | binlog.binlog-socket | | +| tidb | 127.0.0.1:4000 | binlog.enable | false | +... +40 rows in set (0.01 sec) +``` + +## MySQL compatibility + +`SHOW CONFIG` is the extended syntax of TiDB, with no counterpart in MySQL. + +## See also + +* [SHOW VARIABLES](/sql-statements/sql-statement-show-variables.md)