Delete a MySQL Database on Linux

Pre-Flight Check
These instructions are intended for deleting a MySQL database on Linux via the command line.
I’ll be working from a Liquid Web Core Managed CentOS 7 server, and I’ll be logged in as root.

First we’ll login to the MySQL server from the command line with the following command:

mysql -u root -p

Delete a Database in MySQL

It only takes one simple command to delete a database in MySQL, but BEWARE; dropping a database can not be undone! The command is as follows:

DROP DATABASE tutorial_database;

If a database of the name tutorial_database does not exist, then you’ll receive this error:

ERROR 1008 (HY000): Can’t drop database ‘tutorial_database’; database doesn’t exist

To avoid seeing this error use the following command instead:

DROP DATABASE IF EXISTS tutorial_database;