January 11, 2023 By Matthew Rathbone *

To delete a database in MySQL, you will need to have access to the MySQL command line or a graphical interface like Beekeeper Studio. Once you have access, follow these steps:

👋 Check out our easy to use desktop GUI for SQL

Beekeeper Studio is a truly cross-platform SQL GUI with a clean, uncluttered interface. Write SQL, edit data, alter tables, and more!

Available for MacOS, Linux, and Windows.

Log In

Log in to the MySQL server using the root user account or a user account with administrative privileges. You will need to enter the password for the account when prompted.

View Existing Databases

Use the SHOW DATABASES command to view a list of all the databases on the server. This will help you confirm the name of the database you want to delete.

DROP DATABASE

Use the DROP DATABASE command to delete the database. This command takes the name of the database as its argument, so you will need to specify the name of the database you want to delete. For example, if the database you want to delete is named mydb, you would use the following command:

DROP DATABASE mydb;

Check The Result

Use the SHOW DATABASES command again to verify that the database has been deleted. The database should no longer appear in the list of databases on the server.

DROP DATABASE Is Permanent

It’s important to note that the DROP DATABASE command is a permanent action and cannot be undone. Therefore, it’s always a good idea to take a backup of the database before deleting it, just in case you need to restore it later.

Additionally, you should exercise caution when using the DROP DATABASE command, as it can have unintended consequences if used incorrectly. For example, if you accidentally drop a database that contains important data, you may not be able to recover that data. It is always a good idea to double-check the database name before executing the DROP DATABASE command.