1008
MariaDBERRORCommonDDLHIGH confidence
Can't drop database — database doesn't exist
Production Risk
Low — no data is affected.
What this means
ER_DB_DROP_EXISTS (1008, SQLSTATE HY000) is raised when DROP DATABASE is called for a database that does not exist and IF EXISTS was not used.
Why it happens
- 1DROP DATABASE called without IF EXISTS on a non-existent database
- 2Database was already dropped or never created
- 3Typo in the database name
How to reproduce
trigger — this will error
trigger — this will error
DROP DATABASE nonexistent_db;
expected output
ERROR 1008 (HY000): Can't drop database 'nonexistent_db'; database doesn't exist
Fix
Use DROP DATABASE IF EXISTS
WHEN In migration or teardown scripts that may run multiple times.
Use DROP DATABASE IF EXISTS
DROP DATABASE IF EXISTS nonexistent_db;
Why this works
IF EXISTS suppresses the error when the database does not exist, making the statement safe to re-run.
What not to do
✕ Ignore 1008 silently in all cases
In some contexts 1008 may indicate a configuration problem; log and review even when using IF EXISTS.
Sources
Official documentation ↗
MySQL 8.0 — 1008 ER_DB_DROP_EXISTS
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev