CREATE DATABASE
Grammar Description
The CREATE DATABASE statement is used to create a database.
Grammar Structure
> CREATE DATABASE [IF NOT EXISTS] <database_name> [create_option] ...
> create_option: [DEFAULT] {
CHARACTER SET [=] charset_name
| COLLATE [=] collation_name
| ENCRYPTION [=] {'Y' | 'N'}
}
Example
CREATE DATABASE IF NOT EXISTS test01;
Expected results
You can use SHOW DATABASES to check if the database has been created.
mysql> show databases;
+-------------------------+
| Database |
+-------------------------+
| mo_task |
| information_schema |
| mysql |
| system_metrics |
| system |
| test01 |
| mo_catalog |
+-------------------------+
10 rows in set (0.01 sec)
As you can see, in addition to the 6 system databases that already exist, the new database test01 has been created.
limit
- Currently only
UTF-8character set is supported. CHARACTER SET,COLLATE,ENCRYPTIONis currently available but cannot be effective.