多测师_MySQL 库操作

1、库操作

  • 展示本地所有库
    • show databases;
mysql> show databases;

+--------------------+
| Database           |
+--------------------+
| information_schema |
| cms                |
| mysql              |
| test               |
+--------------------+
  • 创建数据库
    • create database + 库名;
# 创建 student 库
mysql> create database student;

# 查看库
mysql> show databases;

+--------------------+
| Database           |
+--------------------+
| information_schema |
| cms                |
| mysql              |
| student            |
| test               |
+--------------------+
  • 选择进入某个数据库
    • user + 库名;
mysql> use student;
Database changed
  • 删除数据库
    • drop database + 库名;
# 删除数据库 student
mysql> drop database student;

# 查看验证 student 库是否成功删除
mysql> show databases;

+--------------------+
| Database           |
+--------------------+
| information_schema |
| cms                |
| mysql              |
| test               |
+--------------------+

 

你可能感兴趣的:(多测师_Database)