7.4. Dropping Databases


When you no longer need a database, you can remove it with DROP DATABASE:

 DROP DATABASE mydb; 

It is an error if the database does not exist. To cause a warning instead, include an IF EXISTS clause:

 DROP DATABASE IF EXISTS mydb; 

Any warning generated when IF EXISTS is used can be displayed with SHOW WARNINGS.

DROP DATABASE does not require the database to be empty. Before dropping the database, MySQL removes any objects that it contains, such as tables, stored routines, and triggers.

DROP DATABASE is a dangerous statement and you should use it with care. There is no statement to "undo" DROP DATABASE. If you drop a database by mistake, your only option is to recover the database and its contents from your backups.



MySQL 5 Certification Study Guide
MySQL 5.0 Certification Study Guide
ISBN: 0672328127
EAN: 2147483647
Year: 2006
Pages: 312

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net