CREATE DATABASE [IF NOT EXISTS]
create_specification: [DEFAULT] CHARACTER SET [=]
charset_name| [DEFAULT] COLLATE [=]
An error occurs if the database exists and you did not specify
IF NOT EXISTS.
As of MySQL 4.1.1,
options specify database characteristics. Database characteristics
are stored in the
db.opt file in the database
CHARACTER SET clause specifies
the default database character set. The
clause specifies the default database collation.
Section 9.1, “Character Set Support”, discusses character set and collation
A database in MySQL is implemented as a directory 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 (and the
db.opt file, for MySQL 4.1.1 and up). Rules
for allowable database names are given in
Section 8.2, “Database, Table, Index, Column, and Alias Names”.
If you manually create a directory under the data directory (for
example, with mkdir), the server considers it a
database directory and it shows up in the output of
You can also use the mysqladmin program to create databases. See Section 4.5.2, “mysqladmin — Client for Administering a MySQL Server”.