1. Create a database
CREATE{DATABASE | SCHEMA}[IF not EXISTS] db_name [create_specification [, Create_specification] ...] Create_specification:[DEFAULT] CHARACTER SETCharset_name| [DEFAULT]COLLATE collation_name
Create database is used for creating databases and naming them. Where [] the contents are represented as optional.
The CHARACTER set is used to specify the character set used by the database and collate to specify proofing rules.
Example: Creating a Database Elective_sys, the character set uses UTF8.
CREATE DATABASE DEFAULT CHARSET UTF8;
2. Use the database as the default (current) database for subsequent statements
Use db_name
3. Modify Database Information
ALTER{DATABASE | SCHEMA}[db_name]alter_specification[, Alter_specification]... alter_specification:[DEFAULT] CHARACTER SETCharset_name| [DEFAULT]COLLATE collation_name
Example: Change the character set of the database Elective_sys to GBK.
ALTER DATABASE DEFAULT CHARSET GBK;
MySQL database operation statement