How to Delete a Database in MySQL and MariaDB

by Ismail.EL
0 comment

To delete a database in MySQL or MariaDB, use the following Steps:

Step 1: Connect to your database server:

To begin, sign into MySQL with the following command:

Enter the administrator password you set up during installation.

Step 2: Display a list of your available databases.

Enter the command SHOW DATABASES; to list all of the databases you have stored. Besides the database you just created.

Step 3: Delete Your  database:

To delete a database in MySQL or MariaDB, use the following command:

This operation cannot be reversed! Make certain you wish to delete before pressing enter!

If this command is executed on a database that does not exist, the following error message will be given:

To prevent this error, and ensure that the command executes successfully regardless of if the database exists, call it with the following syntax:

Conclusion

In this post, i have explained How to Delete a Database in MySQL and MariaDB.
If you have any questions or feedback, feel free to leave a comment.
As always, if you found this post useful, then click like and share it 🙂

19170cookie-checkHow to Delete a Database in MySQL and MariaDB

Related Posts

Leave a Comment