Bug #81850 Add DROP DATABASE .. IF EMPTY
Submitted: 14 Jun 2016 14:51 Modified: 7 Jan 2021 9:35
Reporter: Daniël van Eeden (OCA) Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server: General Severity:S4 (Feature request)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any

[14 Jun 2016 14:51] Daniël van Eeden
Description:
When automating it can be useful to have a safe method of dropping a database.

Something like "DROP DATABASE my_schema IF EMPTY"

How to repeat:
See description
[15 Jun 2016 8:44] Daniël van Eeden
IF EMPTY means not having any tables, routines, events, etc in there
[15 Jun 2016 8:53] Daniël van Eeden
This is similar to how rmdir(1) works in UNIX
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/rmdir.html
[7 Jan 2021 9:35] Daniël van Eeden
It should/could just check this based on the data dictionary.

https://dev.mysql.com/doc/refman/8.0/en/data-dictionary.html