TiDBTiDB Docs Dash 2024

Jan 9 - Jan 12 (UTC)
Join us to improve docs and win a prize!
Sign InTry Free

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
SHOWCREATEDATABASESCHEMAIFNOTEXISTSDBName

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.

See also

Was this page helpful?

Download PDFRequest docs changesAsk questions on Discord
Playground
New
One-stop & interactive experience of TiDB's capabilities WITHOUT registration.
Products
TiDB
TiDB Dedicated
TiDB Serverless
Pricing
Get Demo
Get Started
© 2024 PingCAP. All Rights Reserved.
Privacy Policy.