First, we will login to the MySQL server through command line :
# mysql -u root -p ******
Here, -u option is for username and -p option is for the password.
Now, you will be at MySQL prompt and it looks like this :
# mysql>
Now, to delete a database from the server you have to run this command :
# mysql> DROP DATABASE datbase-name; //Syntax
# mysql> DROP DATABASE example_database; //Example
If the database is not present on the server it will show an error like this :
ERROR 1008 (HY000): Can't drop database 'example_database'; database doesn't exist
To avoid this message you can use this command :
# mysql> DROP DATABASE IF EXISTS datbase-name; //Syntax # mysql> DROP DATABASE IF EXISTS example_database; //Example