The MySQL Drop database command is used to delete a database, and if you attempt to delete a nonexistent database using the drop DATABASE command, you receive this error: Error 1008 (HY000): Can ' t drop database ' Tutorial_database '; Database doesn ' t exist, this article introduces you to MySQL drop database usages.
First, we need to connect to the database server before we delete the database using drop db.
We can log on to the MySQL server using the following command:
Mysql-u root-p
-U represents the username identifier, root indicates the user name value, and-p represents the password, because the password is not entered after-p, so MySQL prompts for the password. Enter your current password to complete the login.
If you need to change the password in the database, you can read this website's text, "modify the MySQL password through the command line."
After connecting to the MySQL database server, we can delete any database that exists in the database server.
Just need a simple command to delete the database in MySQL, but be careful; Delete database cannot be restored, MySQL command as follows:
DROP DATABASE tutorial_database;
If the database tutorial_database does not exist, you will receive this error:
ERROR 1008 (HY000): Can ' t drop database ' tutorial_database '; Database doesn ' t exist
To avoid this error, use the following command:
DROP DATABASE IF EXISTS tutorial_database;
If the Tutorial_database database exists in the database server, the above command deletes the database. Otherwise, no action is made.
After the delete command has been executed, we can use the show database command to see if the databases have been deleted.
To view the list of databases simply issue the following command:
Show DATABASES;
Your results should be similar to this:
Mysql> show DATABASES;
+--------------------+
| Database |
+--------------------+
| Information_schema |
| MySQL |
| Test |
+--------------------+
4 rows in Set (0.00 sec)
' Above is the MySQL drop database to delete databases command instances of data collation, follow-up continue to supplement the relevant information thank you for your support of this site!