MySQL DatabaseLesson 48Free preview
MySQL Drop DB
This lesson is part of MySQL · All levels
Summary
The database was permanently deleted from the server with the DROP DATABASE command. This command removes all the contents of the database, such as tables, indexes, and data, so it must be used with great care. Always add IF EXISTS to avoid errors when the database is not found, and back it up before running it.
Key points
- DROP DATABASE permanently deletes the database and all its tables and data
- DROP DATABASE IF EXIST... prevents errors when the database does not exist
- Unlike deleting lines, DROP doesn't leave any data at all.
- Always backup with mysqldump before a destructive operation
- GRANT access control determines who can run the DROP
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.