;"."/> ;".">
Home >Database >Mysql Tutorial >How to delete database in MySQL
Method: You can use the "DROP DATABASE" statement to delete the created database; the specific syntax is "DROP DATABASE [IF EXISTS] e5c249aa15ff4c64720f99bfaecf8a60;".
The operating environment of this tutorial: Windows 7 system, mysql version 8.0.22, Dell G3 computer.
(Recommended tutorial: mysql video tutorial)
In MySQL, when you need to delete a created database, you can use the DROP DATABASE statement. The syntax format is:
DROP DATABASE [ IF EXISTS ] <数据库名>;
The syntax description is as follows:
51ede4c6d43f3b2169203bd49746727d: Specify the name of the database to be deleted.
IF EXISTS: Used to prevent errors from occurring when the database does not exist.
DROP DATABASE: Delete all tables in the database and delete the database at the same time. Be very careful when using this statement to avoid mistaken deletions. If you want to use DROP DATABASE, you need to obtain database DROP permission.
Example:
Query the database list
mysql> SHOW DATABASES; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sakila | | sys | | test_db | | world | +--------------------+ 7 rows in set (0.00 sec)
Delete the database test_db from the database list
mysql> DROP DATABASE test_db; Query OK, 0 rows affected (0.57 sec) mysql> SHOW DATABASES; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sakila | | sys | | world | +--------------------+ 6 rows in set (0.00 sec)
For more programming-related knowledge, please visit: programming video! !
The above is the detailed content of How to delete database in MySQL. For more information, please follow other related articles on the PHP Chinese website!