MySQL Tutorial – Creating a database in MySQL

How to create a database in MySQL?

To create a database in MySQL, we are going to use the CREATE DATABASE command. We will name our database as “employee”, to do that issue the following command:

CREATE DATABASE employee;

Note: each time you issue a command in MySQL it ends with a semi-colon(;).

If you have done it correctly the MySQL will respond a success message, it means we have successfully created the database. The message would look like this:

Query OK, 1 row affected (0.00 sec)

Let’s try to check the list of databases in our system. Issue the following command:

SHOW DATABASES;

The result would look like this:

+----------------+
| Database       |
+----------------+
| employees      |
| mysql          |
+----------------+
2 rows in set (0.00 sec)
, , ,

Post navigation

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.