Creating, Dropping, and Selecting Databases
MySQL provides three database-level statements:CREATE DATABASE for creating databases, DROP DATABASE for removing them, and USE for selecting a default database.
The CREATE DATABASE Statement
Creating a database is easy; just name it in a CREATE DATABASE statement:
CREATE DATABASE db_name
The constraints are that the name must be legal, the database must not already exist, and you must have sufficient privileges to create it.
The DROP DATABASE Statement
Dropping a database is just as easy as creating one, assuming you have sufficient privileges:
DROP DATABASE db_name
However, the DROP DATABASE statement is not something you should use with wild abandon. It removes the database and all tables ...
Get MySQL now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.