How to Drop a MySQL Database on Linux via Command line

How to Drop a MySQL Database on Linux via Command Line

We will show you how to drop a database in command line on a linux server with MySQL or MariaDB installed.


First you need to log your MySQL/MariaDB

mysql -u root -p


List all the databases

MariaDB> show databases;         
+--------------------+
| Database           |
+--------------------+
| information_schema |
| example            |
| mysql              |
| performance_schema |
+--------------------+
4 rows in set (0.00 sec)


Drop the database

In this example, we will erase the database “example”

MariaDB> DROP DATABASE example;


Check if the database is erased

MariaDB> show databases;         
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)


Colo-Serv Communications has written 20 articles

Premium Dedicated Server in Canada

Leave a Reply

Your email address will not be published. Required fields are marked *

four + eight =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>