Mysql drop database delete database command instance description, drop instance description
The mysql drop database Command is used to delete a database. If you try to use the drop database Command to delete a database that does not exist, you will receive the ERROR: ERROR 1008 (HY000 ): can't drop database 'tutorial _ database'; database doesn' t exist. This article introduces the mysql drop database instance.
Before using drop database to delete a database, we need to connect to the database server.
Run the following command to log on to the mysql server:
Mysql-u root-p
-Utable indicates the user name identifier. root indicates the user name value, and-p indicates the password. Because-p does not enter the password, MySQL will prompt you to enter the password. Enter your current password to log on.
If you need to change the password in the database, you can read the text "Modify MySQL password through command line" on this website.
After connecting to the mysql database server, we can delete any existing databases in the database server,
You only need a simple command to delete the database in MySQL, but be careful. Deleting the database cannot be recovered. The mysql Command is 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, run the following command:
Drop database if exists tutorial_database;
If the tutorial_database database exists on the database server, the preceding command deletes the database. Otherwise, no operation is performed.
After executing the DELETE command, we can run the show database command to check whether the database has been deleted.
To view the Database List, run 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)
'The above is how mysql drop database deletes database Command instances. We will continue to add relevant information later. Thank you for your support for this site!