In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to write the command to delete the database, which has certain reference value and can be used for reference by friends who need it. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.
The command to delete the database is "DELETE DATA" in the format "DROP DATABASE [IF EXISTS] database name;", you can delete all tables in the database and delete the database at the same time. If you want to use "DROP DATABASE", you need to obtain database DROP permission.
You should delete a database when it is no longer in use to ensure that valid data is stored in the database storage space. Deleting a database removes an existing database from disk space, and after it is cleared, all data in the database will be deleted as well.
In MySQL, you can use the DROP DATABASE statement when you need to delete a created database. Its grammatical format is:
DROP DATABASE [IF EXISTS] database name
The syntax is as follows:
Database name: specifies the name of the database to delete.
IF EXISTS: used to prevent errors 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 erroneous deletion. If you want to use DROP DATABASE, you need to obtain database DROP permission.
Note: after MySQL installation, the system will automatically create two system databases named information_schema and mysql. The system database stores some information related to the database. If these two databases are deleted, MySQL will not work properly.
Example:
View the database
Mysql > SHOW DATABASES +-+ | Database | +-+ | information_schema | | mysql | | performance_schema | | sakila | | sys | | test_db | | test_db_char | | test_db_del | | world | +- -+ 9 rows in set (0.00 sec)
Use the command line tool to remove the database test_db_del from the database list
Mysql > DROP DATABASE test_db_del;Query OK, 0 rows affected (0.57 sec) mysql > SHOW DATABASES +-+ | Database | +-+ | information_schema | | mysql | | performance_schema | | sakila | | sys | | test_db | | test_db_char | | world | +- -+ 8 rows in set (0.00 sec)
The database test_db_del does not exist at this time.
Thank you for reading this article carefully. I hope it will be helpful for everyone to share the command to delete the database. At the same time, I also hope you can support us, pay attention to the industry information channel, and find out if you have any problems. detailed solutions are waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.