Moreover, if the deleted database files are offline when removed, the disk files will not be dropped. It requires deleting them manually by utilizing Windows Explorer.
This post will talk about the procedure to drop the database in MySQL.
How to DROP Databases in MySQL?
To drop the database in MySQL, follow the below-state procedure:
- Open the terminal and connect it to the MySQL server through username and password.
- View all the existing databases.
- Choose one that you want to drop.
- Run the “DROP DATABASE <database-name>;” command.
Step 1: Access MySQL Server
First, lunch the terminal and execute the following command to access MySQL through username and password:
Step 2: Display Databases
Run the “SHOW” command to view all available databases from MySQL:
According to the following output, multiple databases exist, and we have selected the highlighted database:
Step 3: DROP Database
Finally, use the “DROP” command to delete the previously selected “newdb” database:
The output as “Query OK, ….” means the specified query has been executed successfully:
Step 4: Verify DROP Operation
Lastly, verify if the specified is deleted successfully or not, use the “SHOW” command:
It can be observed that the particular database does not exist anymore in the list:
That’s all! We have provided the procedure to drop the database in MySQL.
Conclusion
To drop the database in MySQL, first, open the terminal and connect it to the MySQL server through username and password. Then, view all the existing databases and select one that you want to drop. After that, execute the “DROP DATABASE <database-name>;” command. This post explained the procedure to drop the database in MySQL.