Javatpoint Logo
Javatpoint Logo

MySQL Create Database

A database is a collection of data. MySQL allows us to store and retrieve the data from the database in a efficient way. In MySQL, we can create a database using the CREATE DATABASE statement. But, if database already exits, it throws an error. To avoid the error, we can use the IF NOT EXISTS option with the CREATE DATABASE statement.

You can create a MySQL database by using MySQL Command Line Client. Open the MySQL console and write down password, if you set one while installation. You will get the following:

mysql create database 1

Now you are ready to create database.

Syntax:

Example:

Let's take an example to create a database name "employees"

It will look like this:

mysql create database 2

You can check the created database by the following query:

Output

mysql create database 3

Here, you can see the all created databases.

Note: All the database names, table names and table fields name are case-sensitive. You must have to use proper names while giving any SQL command.





Help Others, Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA