CREATE DATABASE
syntax
CREATE DATABASE [IF NOT EXISTS] db_name
CREATE DATABASE
creates a database with the given name. Rules for allowable database names are given in section 7.1.5 Database, table, index, column and alias names. An error occurs if the database already exists and you didn't specify IF NOT EXISTS
.
Databases in MySQL are implemented as directories containing files that correspond to tables in the database. Because there are no tables in a database when it is initially created, the CREATE DATABASE
statement only creates a directory under the MySQL data directory.
You can also create databases with mysqladmin
. See section 14.1 Overview of the different MySQL programs.