MySQL create database

Creating MySQL database

Before you can start inserting, deleting or using data in MySQL, you have to create a MySQL database. For that, you must have certain privileges in order to create a database and if you are logged in as administrator then you already have it.

After creating a database, you can create tables and start inserting or querying data from the database. The create database syntax is quite simple as explained below.

Create database syntax

The general syntax of MySQL create database is:


The database name should be in accordance to your project. For this Create database MySQL tutorial we will use the test_db.

An example of create database command of MySQL

This is how you can create a MySQL database by using its command:


As you run this command in MySQL database system, a database with the name test_db will be created. Now you can start creating tables, inserting data and then retrieve that data from that database.

See Also: how to drop MySQL database | Create table in MySQL

Was this article helpful?

Related Articles

Leave A Comment?