SHOW CREATE 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.
Synopsis
ShowCreateDatabaseStmt:
ShowCreateDatabaseStmt
ShowCreateDatabaseStmt ::=
"SHOW" "CREATE" ("DATABASE" | "SCHEMA") ("IF" "NOT" "EXISTS")? DBName
Examples
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)
MySQL compatibility
SHOW CREATE DATABASE
is expected to be fully compatible with MySQL. If you find any compatibility differences, you can report a bug.