MySQL – Drop Database

      No Comments on MySQL – Drop Database




Database in MySQL can be dropped using DROP DATABASE statement.

Syntax to Drop Database:

DROP DATABASE databasename

e.g. to drop an existing database test, the below command can be used:

mysql> DROP DATABASE test;

After a database is dropped in mysql, it can be verified whether database got dropped or not. It can be verified using SHOW DATABASES; statement.

What if database does not exist and We try to drop database in MySQL??

If a database does not exist and we try to drop a database then it would give an error saying database does not exist.

mysql> drop database test123;
ERROR 1008 (HY000): Can’t drop database ‘test123’; database doesn’t exist