1. MySQL database
View an existing database
1 mysql> show databases; 2 +--------------------+ 3 | Database | 4 +--------------------+ 5 | information_schema | 6 | mysql | 7 | performance_schema | 8 +--------------------+ 9 3 rows in set (0.00 sec)
Create a database, then view the database
1 mysql> create database mysqltest; 2 mysql> show databases; 3 +--------------------+ 4 | Database | 5 +--------------------+ 6 | information_schema | 7 | mysql | 8 | mysqltest | 9 | performance_schema | 10 +--------------------+ 11 4 rows in set (0.00 sec) 12 13 mysql>
Switch to the current database we just created
mysql> use mysqltest; Database changed
Modify the database
Modify the default character set and collation of the database you just created
mysql> alter database mysqltest default character set gb2312 default collate gb2312_chinese_ci; Query OK, 1 row affected (0.00 sec) mysql>
delete database
mysql> drop database if exists mysqltest; Query OK, 0 rows affected (0.00 sec) mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | +--------------------+ 3 rows in set (0.01 sec) mysql>