Skip to main content
Deletes a database.

Syntax

Deletes the database and all of its objects including tables, views and aggregating indexes. DROP DATABASE [IF EXISTS] <database_name>

Parameters

ParameterDescription
<database_name>The name of the database to be deleted

Restrictions

A database cannot be dropped if it is used as a default database for any engine. To check which engines are using a specific database as their default, run the following query:
SELECT engine_name 
FROM information_schema.engines 
WHERE default_database = 'db_name';
If the query returns no results and you expect engines to be using this database, you may not have the necessary permissions to view engine information. Contact your account administrator for assistance. Before dropping the database, you must change the default database for all affected engines using the ALTER ENGINE command. For more information, see: