DROP DATABASE [IF EXISTS]
When a database is dropped, user privileges on the database are
not automatically dropped. See
Section 18.104.22.168, “
In MySQL 3.22 or later, you can use the keywords
EXISTS to prevent an error from occurring if the
database does not exist.
As of MySQL 4.1.1, if the default database is dropped, the default
database is unset (the
If you use
DROP DATABASE on a
symbolically linked database, both the link and the original
database are deleted.
As of MySQL 4.1.2,
returns the number of tables that were removed. This corresponds
to the number of
.frm files removed.
DROP DATABASE statement removes
from the given database directory those files and directories that
MySQL itself may create during normal operation:
All files with the following extensions.
All subdirectories with names that consist of two hex digits
ff. These are
subdirectories used for
RAID tables. (These
directories are not removed in versions of MySQL after 4.1,
where support for
RAID tables is removed.
You should convert any existing
and remove these directories manually before upgrading to
later MySQL versions.)
db.opt file, if it exists.
If other files or directories remain in the database directory
after MySQL removes those just listed, the database directory
cannot be removed. In this case, you must remove any remaining
files or directories manually and issue the
DROP DATABASE statement again.
You can also drop databases with mysqladmin. See Section 4.5.2, “mysqladmin — Client for Administering a MySQL Server”.