create new database in mysql query code example

Example 1: create database in mysql

The CREATE DATABASE statement is used to create a new SQL/MySQL database.

Syntax
CREATE DATABASE databasename;

CREATE DATABASE Example
The following SQL statement creates a database called "testDB":

Example
CREATE DATABASE testDB;

Example 2: MySQL CREATE DATABASE

MySQL implements a database as a directory that contains all files which correspond to tables in the database.

To create a new database in MySQL, you use the CREATE DATABASE statement with the following syntax:

CREATE DATABASE [IF NOT EXISTS] database_name
[CHARACTER SET charset_name]
[COLLATE collation_name]

Tags:

Misc Example