Files
MySQL-Study/数据库3.2.md
2025-11-14 13:23:28 +08:00

21 lines
856 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 一、数据库对象
1. 数据库DB是存储数据对象的容器
2. 数据库对象包括:表、视图、触发器、存储过程等
3. 创建数据库对象之前必须要先创建DB
# 二、创建数据库
语法(大小写不区分):
`Create database [if not exists] `数据库名
`[[default] character set 字符集名] `设置默认字符集
`[[default] collate 校对规则名] `设置默认字符集
# 三、维护数据库
1. 查看数据库
* 查看数据库中数据库列表信息
* 查看指定数据库定义 `show create database 数据库名`
2. 修改数据库
* `Alter database [if not exists] `数据库名
`[[default] character set 字符集名] `设置默认字符集
`[[default] collate 校对规则名] `设置默认字符集
3. 删除数据库
* `drop database [if exists]` 数据库名