1. Home
  2. MySQL Tutorials
  3. MySQL Drop Database

MySQL Drop Database

The DROP DATABASE statement is used for dropping or removing a MySQL database.

The effect of this command is a permanent elimination of an existing database and its table. In light of this effect, adequate care and
thought should be applied before the statement is used.

Syntax:

DROP DATABASE database_name;

Example:

Login to MySQL Database with UserName and Password using below command.

# mysql -u mysqladmin -p

In this example, let’s drop the database “FOSS”

mysql> DROP DATABASE  FOSS;

In addition, the DROP DATABASE command might produce an error. This is often the case when there is no existing database. Meanwhile, to remedy a situation of this nature, the IF EXIST OPTION should be used along with the DROP DATABASE.

mysql> DROP DATABASE IF EXIST FOSS;

 

Was this article helpful to you? Yes No

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.