DROP DATABASE
+2
The DROP DATABASE
statement permanently removes a specified database schema, and all of the tables and views that were created inside. User privileges that are associated with the dropped database remain unaffected.
Synopsis
- DropDatabaseStmt
- IfExists
DropDatabaseStmt ::=
'DROP' 'DATABASE' IfExists DBName
IfExists ::= ( 'IF' 'EXISTS' )?
Examples
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| INFORMATION_SCHEMA |
| PERFORMANCE_SCHEMA |
| mysql |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql> DROP DATABASE test;
Query OK, 0 rows affected (0.25 sec)
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| INFORMATION_SCHEMA |
| PERFORMANCE_SCHEMA |
| mysql |
+--------------------+
3 rows in set (0.00 sec)
MySQL compatibility
This statement is understood to be fully compatible with MySQL. Any compatibility differences should be reported via an issue on GitHub.
See also
DROP DATABASE | TiDB SQL Statement Referencewas last updated 6/6/2022, 8:02:15 AM: remove aliases for v6.1 docs (#8795)