title | summary |
---|---|
SHOW CREATE DATABASE |
An overview of the use of SHOW CREATE DATABASE in the TiDB database. |
SHOW CREATE DATABASE
is used to show the exact SQL statement for re-creating an existing database. SHOW CREATE SCHEMA
is a synonym for it.
ShowCreateDatabaseStmt:
ShowCreateDatabaseStmt ::=
"SHOW" "CREATE" ("DATABASE" | "SCHEMA") ("IF" "NOT" "EXISTS")? DBName
CREATE DATABASE test;
Query OK, 0 rows affected (0.12 sec)
SHOW CREATE DATABASE test;
+----------+------------------------------------------------------------------+
| Database | Create Database |
+----------+------------------------------------------------------------------+
| test | CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET utf8mb4 */ |
+----------+------------------------------------------------------------------+
1 row in set (0.00 sec)
SHOW CREATE SCHEMA IF NOT EXISTS test;
+----------+-------------------------------------------------------------------------------------------+
| Database | Create Database |
+----------+-------------------------------------------------------------------------------------------+
| test | CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET utf8mb4 */ |
+----------+-------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
SHOW CREATE DATABASE
is expected to be fully compatible with MySQL. If you find any compatibility differences, you can report a bug.