删除数据库
# 销毁数据库
drop database <DatabaseName>;
1
Example: 销毁 student
数据库
mysql> drop database student;
Query OK, 0 rows affected (0.03 sec)
1
2
2
如果试图销毁不存在的数据库:
mysql> drop database student;
ERROR 1008 (HY000): Can't drop database 'student'; database doesn't exist
1
2
2
# 有逼格的方法
drop database if exists <DatabaseName>;
1
Example:
mysql> drop database if exists student;
Query OK, 0 rows affected, 1 warning (0.01 sec)
1
2
2
# 更有逼格 的方法
drop database if exists `<DatabaseName>`;
1
Example:
mysql> drop database if exists `database`;
Query OK, 0 rows affected (0.01 sec)
1
2
2
编辑 (opens new window)
上次更新: 2022/12/03, 17:31:39