EN
MySQL - Create database
0 points
In this article, we would like to show you how to create database in MySQL.
Quick solution:
xxxxxxxxxx
1
CREATE DATABASE `database_name`;
In this example, we will create a new database - diraskDB
.
Query:
xxxxxxxxxx
1
CREATE DATABASE `diraskDB`;
You can optionally add IF NOT EXISTS
statement, so if the database already exists you won't get an error.
Query:
xxxxxxxxxx
1
CREATE DATABASE IF NOT EXISTS `diraskDB`;
Note:
CREATE SCHEMA
is a synonym forCREATE DATABASE
so you can use it alternately.
If you try to create a database that already exists with CREATE DATABASE
query you will get an error:

If you try to CREATE DATABASE IF NOT EXIST
you will get a warning instead:
