文档目录

DROP DATABASE

DROP DATABASE 语句用于永久删除指定的数据库 schema,以及删除所有在 schema 中创建的表和视图。与被删数据库相关联的用户权限不受影响。

语法图

DropDatabaseStmt:

DropDatabaseStmt

DatabaseSym:

DatabaseSym

IfExists:

IfExists

DBName:

DBName

示例

SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| INFORMATION_SCHEMA |
| PERFORMANCE_SCHEMA |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.00 sec)
DROP DATABASE test;
Query OK, 0 rows affected (0.25 sec)
SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| INFORMATION_SCHEMA |
| PERFORMANCE_SCHEMA |
| mysql              |
+--------------------+
3 rows in set (0.00 sec)

MySQL 兼容性

DROP DATABASE 语句与 MySQL 完全兼容。如发现任何兼容性差异,请在 GitHub 上提交 issue

另请参阅