CREATE DATABASE
Description
Create a database.
Syntax
1. > CREATE DATABASE [IF NOT EXISTS] <database_name> [create_option] ...
3. > create_option: [DEFAULT] {
4. CHARACTER SET [=] charset_name
5. | COLLATE [=] collation_name
6. | ENCRYPTION [=] {'Y' | 'N'}
7. }
Examples
1. CREATE DATABASE IF NOT EXISTS test01;
Expected Result
You can use SHOW DATABASES to check if the databases have been created.
1. mysql> show databases;
2. +--------------------+
3. | Database |
4. +--------------------+
5. | mo_task |
6. | information_schema |
7. | mysql |
8. | system_metrics |
9. | system |
10. | test01 |
11. | mo_catalog |
12. +--------------------+
13. 10 rows in set (0.01 sec)
You can see that the new database test01 has been created in addition to the six system databases.
Constraints
- Only
UTF-8CHARACTER SET is supported for now. CHARACTER SET,COLLATE,ENCRYPTIONcan be used but don’t work.
