MySQL Drop Database

You can drop/delete/remove a MySQL database easily with the MySQL DROP DATABASE command. It deletes all the tables of the database along with the database permanently. It throws an error, if the database is not available. We can use the IF EXISTS option with the DROP DATABASE statement. It returns the numbers of tables which are deleted through the DROP DATABASE statement. We should be careful while deleting any database because we will loose all the data available in the database.

Syntax:

snippet
DROP DATABASE database_name;

Example:

Let's take an example to drop a database name "employees"

snippet
DROP DATABASE employees;

It will look like this:

mysql drop database 1

Now you can check that either your database is removed by executing the following query:

snippet
SHOW DATABASES;

Output:

mysql drop database 2

Here, you can see that the database "employees" is removed.

Note
Note: All the database names, table names and table fields name are case sensitive. You must have to use proper names while giving any SQL command.
Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents