Rechercher dans le manuel MySQL
13.1.12 CREATE DATABASE Syntax
- [create_specification] ...
- create_specification:
CREATE DATABASE
creates a database
with the given name. To use this statement, you need the
CREATE
privilege for the database.
CREATE
SCHEMA
is a synonym for CREATE
DATABASE
.
An error occurs if the database exists and you did not specify
IF NOT EXISTS
.
CREATE DATABASE
is not permitted
within a session that has an active LOCK
TABLES
statement.
create_specification
options specify
database characteristics. Database characteristics are stored in
the data dictionary.
The
CHARACTER SET
clause specifies the default database character set. TheCOLLATE
clause specifies the default database collation. Chapter 10, Character Sets, Collations, Unicode, discusses character set and collation names.The
DEFAULT ENCRYPTION
clause, introduced in MySQL 8.0.16, defines the default database encryption, which is inherited by tables created in the database. If theDEFAULT ENCRYPTION
clause is not specified, thedefault_table_encryption
setting defines the default database encryption. If thetable_encryption_privilege_check
variable is enabled, theTABLE_ENCRYPTION_ADMIN
privilege is required to specify a default encryption setting that differs from thedefault_table_encryption
setting. For more information, see Defining an Encryption Default for Schemas and General Tablespaces.
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 creates
only a directory under the MySQL data directory. Rules for
permissible database names are given in
Section 9.2, “Schema Object Names”. If a database name contains special
characters, the name for the database directory contains encoded
versions of those characters as described in
Section 9.2.3, “Mapping of Identifiers to File Names”.
Creating a database directory by manually creating a directory under the data directory (for example, with mkdir) is unsupported in MySQL 8.0.
You can also use the mysqladmin program to create databases. See Section 4.5.2, “mysqladmin — Client for Administering a MySQL Server”.
Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-create-database.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.