In this tutorial, We are going to cover how to Drop database in MySQL.
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.
DROP DATABASE [IF EXISTS] database_name;
Login to MySQL Database with UserName and Password using below command.
# mysql -u mysqladmin -p Enter password: ********
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;