How to Delete a Database with MariaDB

In this article, you 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 perform both of these operations in those different contexts, and you can choose whichever method fits in best with your preferred workflow.

If you are 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.

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 cPanel Bloat check markSSH Key Management

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, you 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 button 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

If everything works as intended, you will see a success message indicating that the operation was successful. You can now leave the cPanel interface or proceed with any other work.

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 you will use.

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

You can enter the 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 MariaDB command prompt, similar to the 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.

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!