介绍完 MySQL 基础知识,我们现在根据思维导图做以下操作

1. 创建数据库
- 语句:create database 数据库名;
- 示例1 - 创建名为db_admin的数据库

- 示例2 - 创建名为 teacher 的数据库

补充:数据库命名原则
- 不能与其他数据库重名
- 由任意字母、阿拉伯数字、下画线和 $ 组成。但不能为纯数字
- 不能用关键字作为数据库名,表名
- 名称最长为64个字符
注意:windows系统下数据库名、表名不区分大小写,Linux要区分
2. 查看数据库
- 语句:show databases;
- 示例 - 查看之前创建的 db_admin 数据库

3. 选择数据库
- 语句:use 数据库名; (注意:分号可以不写)
- 示例 - 使用db_admin数据库

4. 删除数据库
- 语句:drop database 数据库名;
- 示例 - 删除名为teacher的数据库
