SHOW CREATE DATABASE

This MySQL statement just displays the CREATE DATABASE statement for creating the MySQL database given—which isn't very useful for most developers.

Syntax

Below is the syntax for this command. Text within square brackets (i.e, [ and ] ) are optional. Choices are separated by bars (i.e, | ). Ellipses preceded by a comma indicates a repeating pattern. Ellipses before or after syntax are used to highlight a relevant except from the larger syntax. Text displayed in italic letters represent text that should be replaced with the specific names related to the database (e.g., column with the name of the column).

SHOW CREATE {DATABASE|SCHEMA} database

Explanation

This MySQL statement displays an SQL statement that can be used to create a database like the one given. This statement is mostly useful for determining the default character set. It's available as of version 4.1 of MySQL. As of version 5.0.2 of MySQL, the keyword SCHEMA may be used instead of DATABASE.

Examples

Below is an example of this MySQL statement:

SHOW CREATE DATABASE human_resources \G

*************************** 1. row ***************************
       Database: human_resources
Create Database: CREATE DATABASE `human_resources`
                 /*!40100 DEFAULT CHARACTER SET latin1 */

Again, if you prefer you could instead use SHOW CREATE SCHEMA. If you don't want the database name in the results to be quoted with backticks as shown here, you can set the server variable SQL_QUOTE_SHOW_CREATE to 0, instead of its default value of 1.