1. Membuat database
Format :
CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name
[create_specification] ...
create_specification:
[DEFAULT] CHARACTER SET [=] charset_name
| [DEFAULT] COLLATE [=] collation_name
Contoh :
CREATE DATABASE dbData;
2. Mengubah database
Format :
ALTER {DATABASE | SCHEMA} [db_name]
alter_specification ...
ALTER {DATABASE | SCHEMA} db_name
UPGRADE DATA DIRECTORY NAME
alter_specification:
[DEFAULT] CHARACTER SET [=] charset_name
| [DEFAULT] COLLATE [=] collation_name
Contoh :
ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME;
ALTER DATABASE dbData CHARACTER SET= ascii;
ALTER DATABASE dbData COLLATE utf8_general_ci;
ALTER DATABASE dbData CHARACTER SET utf8 COLLATE utf8_general_ci ENCRYPTION = 'Y' READ ONLY = 1;
3. Mengganti nama database
Format :
RENAME {DATABASE | SCHEMA} db_name TO new_db_name;
Contoh :
Rename Database dbData to dbDataNew;
4. Melihat List Database
Format :
SHOW {DATABASES | SCHEMAS}
[LIKE 'pattern' | WHERE expr]
Contoh :
SHOW DATABASES;
SHOW CREATE DATABASE dbData;
5. Menghapus database
Format :
DROP {DATABASE | SCHEMA} [IF EXISTS] db_name
Contoh :
DROP DATABASE dbDataNew;