[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
CREATE DATABASE
Syntax
CREATE DATABASE [IF NOT EXISTS] db_name [create_specification [, create_specification] ...] create_specification: [DEFAULT] CHARACTER SET charset_name | [DEFAULT] COLLATE collation_name |
CREATE DATABASE
creates a database with the given name.
Rules for
allowable database names are given in 10.2 Database, Table, Index, Column, and Alias Names. An error occurs if
the database already exists and you didn't specify IF NOT EXISTS
.
As of MySQL 4.1.1, create_specification
options may be given.
The CHARACTER SET
clause specifies the database character set.
The COLLATE
clause specifies the database collation.
Database characteristics are stored in the `db.opt' file in the database directory.
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 8. MySQL Client and Utility Programs.