Creating databases
Creating a database in MySQL is as simple as declaring the name of the database that you want to create. The syntax reads:
CREATE DATABASE <database name>;
An example of this is:
CREATE DATABASE csv;
As with all SQL statements, blank space is the token by which the command is divided. We first need to tell MySQL that we want to create something by using that keyword. Then we need to tell it what we want to create, a database. Finally, we give it the name of the database followed by the requisite semi-colon (when in MySQL itself).
Note
Note that, in order to create databases in MySQL, the account you use must have the CREATE
privilege on the database.
CREATE
statements are also sensitive to user privileges. If a user is only granted CREATE
privileges on a single database (for example, csv.*
), then that user cannot create databases, but can create tables on that specific database.
Unlike some commands in MySQL, database creation is case-sensitive. So the following CREATE
statements...