# How to permanently delete a database using DROP DATABASE in MariaDB

The command `DROP DATABASE` permanently deletes entire databases in MariaDB. Therefore, the command can only be executed with root or admin privileges and should be used with great caution.

## `DROP DATABASE` in MariaDB

`DROP DATABASE` is a very effective statement for MariaDB, which should only be used **extremely carefully**. It is used to delete a database from a server structure. Once the command has been executed, the **entire database including all tables and data is irretrievably lost** and can no longer be accessed. Only user rights that were established when using [MariaDB CREATE USER](https://www.ionos.com/digitalguide/hosting/technical-matters/mariadb-create-user/) are not automatically revoked. `DROP DATABASE` can only be executed in MariaDB with admin or root privileges. Other commands such as `DELETE DATABASE` for MariaDB or `REMOVE DATABASE` for MariaDB do not exist.

## Syntax with and without `IF EXISTS`

The syntax of `DROP DATABASE` in MariaDB is as follows:

```sql
DROP DATABASE Name_of_database;
```

Replace the placeholder “Name\_of\_database” with the name of the specific database you want to delete.

You can optionally include `IF EXISTS` to avoid receiving an error message if the database is not found on your server.

```sql
DROP DATABASE IF EXISTS Name_of_database;
```

## How does DROP DATABASE in MariaDB work?

To illustrate how `DROP DATABASE` works in MariaDB, we will use a simple example. Let’s imagine that a database called “Tasks\_2023” is no longer needed. Therefore, we use `SHOW DATABASES` to check if the database is still on the server and then remove it. This is the code:

```sql
mysql> SHOW DATABASES;
mysql> DROP DATABASE Tasks_2023;
```

Tip In our Digital Guide we also reveal how to create a new database with [MariaDB CREATE DATABASE](https://www.ionos.com/digitalguide/hosting/technical-matters/mariadb-create-database/) and how to call up a database with [MariaDB SELECT DATABASE](https://www.ionos.com/digitalguide/hosting/technical-matters/mariadb-select-database/). You will also find a [MariaDB and MySQL comparison](https://www.ionos.com/digitalguide/hosting/technical-matters/mariadb-vs-mysql/) and learn everything you need to know about [installing MariaDB](https://www.ionos.com/digitalguide/hosting/technical-matters/install-mysql-mariadb/).


This is a markdown version of: [https://www.ionos.com/digitalguide/hosting/technical-matters/mariadb-drop-database/](https://www.ionos.com/digitalguide/hosting/technical-matters/mariadb-drop-database/) for AI/LLM consumption.