How to Delete a Database with MariaDB

How to Delete a Database with MariaDB

In this article, we are going to learn how to delete databases with MariaDB. There are two different ways you can easily delete databases: through the cPanel interface or the command line via SSH. You will see how to do perform both of these operations.

If you were curious about creating databases, you will want to check out the article on how to create databases with MariaDB.

Using MariaDB inside your VPS/Dedicated server involves replacing MySQL as your database storage engine and selecting MariaDB.

How To Delete a MariaDB Database in cPanel

You will have a few options for deleting your database. In the first part of this tutorial, we are going to be deleting a database (or multiple databases) in the familiar, graphical cPanel interface.

First, log into your cPanel. Under Databases, choose MySQL Databases.

select MySQL databases

Under the Current Databases heading, you will see the databases being used, and you can click the Delete link to obliterate one.

delete MariaDB database

You will be asked to confirm your selection. Click Delete Database again to confirm. You will see a success message indicating the database was deleted successfully.

Delete database confirmation

How to Delete MariaDB Database (Command Line Interface)

Once you are working in “the shell,” or, on the command line, you can log into MySQL to manage databases, even when you are using MariaDB as your storage engine. You may refer to deleting a database here as “dropping” a database because that is the command we will use.

This time, instead of logging into cPanel, you will log into your server with SSH instead.

Assume your MySQL user interface with this command:

mysql -u <username> -p

The <username> field can be your cPanel user, database user, or root user, as the situation may warrant.

The -p option prompts you for a password. Once logged in, you will see the same mysql> command prompt that you would see if MySQL was your storage engine. Type in the DROP command to delete a database in MariaDB:

DROP DATABASE db_name;

Of course, replace db_name with the name of the database that you want to drop. Well done, you now know how to drop a database with MariaDB. If the command ran successfully you will see a success message indicating the query was “OK” and rows affected. To exit the MySQL command the prompt you can type Ctrl-d, and you will be dropped back to your normal command prompt.

If you don’t need cPanel, don't pay for it. Only pay for what you need with our Cloud VPS solutions

check markCentOS, Debian, or Ubuntu    check markNo bloatware    check markSSH Key management made easy

CM
Christopher Maiorana Content Writer II

Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.

More Articles by Christopher

Was this article helpful? Let us know!