1. Home
  2. SQL
  3. MySQL Tutorial
  4. SQL – Create Database

SQL – Create Database

SQL CREATE DATABASE

Use CREATE DATABASE statement to create a new database using mysql command. Login to MySQL server with administrative access to create a database.

Syntax

CREATE DATABASE database_name;

Example

Login to your MySQL server using the command line. You will get MySQL database prompt like mysql> . Now use CREATE DATABASE statement to create a database.

mysql> CREATE DATABASE mydb;

You can also use the following command directly on operating system command prompt without login to MySQL first.

$ mysqladmin -u root -p create mydb

To confirm that database is created properly use show databases command from database command prompt to list all databases.

Tags , ,
Was this article helpful to you? Yes 7 No
Advertisement