Complete guide to removing databases in MariaDB. Complete DROP DATABASE syntax with IF EXISTS, permissions, and recovery options for production use.
Syntax
DROP {DATABASE | SCHEMA} [IF EXISTS] db_name
Description
DROP DATABASE drops all tables in the database and deletes the database. Be very careful with this statement! To use DROP DATABASE, you need the on the database. DROP SCHEMA is a synonym for DROP DATABASE.
Important: When a database is dropped, user privileges on the database are not automatically dropped. See .
IF EXISTS
Use IF EXISTS to prevent an error from occurring for databases that do not exist. A NOTE is generated for each non-existent database when using IF EXISTS. See .
Atomic DDL
supports .DROP DATABASE is implemented as
Each individual is atomic while DROP DATABASE as a whole is crash-safe.