环境
MySQL 数据库版本信息:
mysql> status
--------------
mysql Ver 14.14 Distrib 5.7.30, for Linux (x86_64) using EditLine wrapper
Server version: 5.7.30 MySQL Community Server (GPL)
删除一数据库
我有一个 hello-account-1
数据库:
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| hello-account |
| hello-account-1 |
| mysql |
| performance_schema |
| sys |
+--------------------+
6 rows in set (0.00 sec)
现在,我想删除它。
那么,我们可以使用 DROP {DATABASE | SCHEMA} [IF EXISTS] db_name
语法删除它:
mysql> DROP DATABASE `hello-account-1`;
Query OK, 0 rows affected (0.00 sec)
删除成功,数据库没了:
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| hello-account |
| mysql |
| performance_schema |
| sys |
+--------------------+
5 rows in set (0.00 sec)