When you no longer need a database, you can remove it with DROP DATABASE: DROP DATABASE mydb; It is an error if the database does not exist. To cause a warning instead, include an IF EXISTS clause: DROP DATABASE IF EXISTS mydb; Any warning generated when IF EXISTS is used can be displayed with SHOW WARNINGS. DROP DATABASE does not require the database to be empty. Before dropping the database, MySQL removes any objects that it contains, such as tables, stored routines, and triggers. DROP DATABASE is a dangerous statement and you should use it with care. There is no statement to "undo" DROP DATABASE. If you drop a database by mistake, your only option is to recover the database and its contents from your backups. |