Delete MySQL Database Using The Commandline


Delete MySQL database using the command line.

MySQL is the most popular open-source relational database management system. However MariaDB is a better opensource alternative.

This tutorial describes how to delete (or drop) a MySQL or MariaDB database through the command line.

You need to be "root", an administrative user (the minimum privilege required to delete a database is DROP) or with a root account.

Delete MySQL database using the command line.

To access the MySQL console type the following command:

mysql -u root -p

Press Enter and then enter the password if you have one set.

If not, then you can do this instead:

mysql -u root

Press Enter,

List All MySQL Databases

Before dropping the database, you may want to view a list of all the databases you’ve created.

Execute the following command:


Press Enter,

This command will list all databases.

Delete a Database in MySQL:

This a non-reversible action and should be executed with caution!

DROP DATABASE database_name;

Press Enter,]

The output should show:

Query OK, 1 row affected (0.00 sec);

If you try to delete a database that doesn’t exist you will see an error message instead.

To make sure the database exists and avoid seeing errors, use the following command instead:


Press Enter,

Note: You can also delete a MySQL database from the Linux terminal by using the mysqladmin utility, which is faster and less difficult, since it uses a web based interface.

Games For Linux

Windows has always been the preferred platform for gaming, but after STEAM's interest in Linux more game developers are making their games natively available for Linux.


All information on this website is published in good faith and for general educational purposes and for use in safe testing environments only. While strives to make the information on this site as accurate as possible, does not warrant its completeness, reliability and accuracy.

We are not responsible for any losses or damages associated with the use of our website. While we strive to provide only links to useful websites, we have no control over the content of these sites and links to other sites do not constitute a recommendation for all content contained on these websites.


Site Information

This is a professional review site that receives compensation from the companies whose products reviewed. Each service or product are thoroughly tested and given high marks if considered to be the very best. Independently owned and the opinions expressed here are no one elses.


Limited Time Offers

Coming soon...