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.
- How To Delete a MariaDB Database in cPanel
- How to Delete Databases in MariaDB (Command Line Interface)
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 scalable Cloud VPS Hosting.
CentOS, Debian, or Ubuntu No Bloatware SSH and Root Access
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.
Under the Current Databases heading, you will see the databases being used, and you can click the Delete button to obliterate one.
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.
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
<username> field can be your cPanel user, database user, or
root user, as the situation may warrant.
-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.