:: DEVELOPER ZONE
CREATE {DATABASE | SCHEMA} [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. To use CREATE DATABASE, you need the
CREATE privilege on the database.
Rules for allowable database names are given in
Section 9.2, “Database, Table, Index, Column, and Alias Names”. An error occurs if the database
exists and you didn't specify IF NOT EXISTS.
As of MySQL 4.1.1, create_specification options
can be given to specify database characteristics. Database
characteristics are stored in the db.opt file
in the database directory. The CHARACTER SET
clause specifies the default database character set. The
COLLATE clause specifies the default database
collation. Character set and collation names are discussed in
Chapter 10, Character Set Support.
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 (and the
db.opt file, for MySQL 4.1.1 and up).
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 SHOW
DATABASES.
CREATE SCHEMA can be used as of MySQL 5.0.2.
You can also use the mysqladmin program to create databases. See Section 8.4, “mysqladmin, Administering a MySQL Server”.
© 1995-2005 MySQL AB. All rights reserved.

User Comments
Warning: query failed: Unknown column 'user.firstname' in 'field list' in /data0/sites/live/web-main/lib/mysql-cxn.php on line 69
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /data0/sites/live/web-main/lib/docbook.php on line 245
Add your own comment.