MySQL Tutorial MySQL Advanced MySQL Database Account Management MySQL References

MySQL DROP DATABASE Keyword



The MySQL DROP DATABASE keyword is used to drop an existing MySQL database.

Syntax

The syntax of using DROP DATABASE statement is given below:

DROP DATABASE DatabaseName;

Please note that to drop any database, admin privilege is required. Along with this, take extra measures while dropping a database. Deleting a database will result in loss of complete information stored in the database.

After deleting the database, the following command can be used to see the list of available databases in RDBMS.

SHOW DATABASES;

Example: drop a database

To drop an existing database with name testDB, the following query can be used:

DROP DATABASE testDB;

After creating the database, the SHOW DATABASES; command can be used to see the list of databases available in RDBMS.

MySQL > SHOW DATABASES;
+-------------+
| Database    |
+-------------+
| SQLExample1 |
| SQLExample2 |
| SQLExample3 |
| SQLExample4 |
| SQLExample5 |
| SQLExample6 |
| SQLExample7 |
| SQLExample8 |
+-------------+
8 rows in set (0.00 sec)

❮ MySQL Keywords

5