Skip to content

Latest commit

 

History

History
55 lines (42 loc) · 1.46 KB

sql-statement-drop-database.md

File metadata and controls

55 lines (42 loc) · 1.46 KB
title summary aliases
DROP DATABASE | TiDB SQL Statement Reference
An overview of the usage of DROP DATABASE for the TiDB database.
/docs/dev/sql-statements/sql-statement-drop-database/
/docs/dev/reference/sql/statements/drop-database/

DROP DATABASE

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 ::=
    '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

The DROP DATABASE statement in TiDB is fully compatible with MySQL. If you find any compatibility differences, report a bug.

See also