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.
- 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.
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.
Under the Current Databases heading, you will see the databases being used, and you can click the Delete link 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.
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
<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
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.
CentOS, Debian, or Ubuntu No bloatware SSH Key management made easy