MySQL数据库
查看已经存在的数据库
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)
创建数据库,再查看数据库
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>
切换到当前我们刚才所创建的数据库
mysql> use mysqltest; Database changed
修改数据库
修改刚才创建的数据库的默认字符集和校对规则
mysql> alter database mysqltest default character set gb2312 default collate gb2312_chinese_ci; Query OK, 1 row affected (0.00 sec) mysql>
删除数据库
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>