How to Create Database in MySQL

The Syntax to create a database in MySQL Server is "CREATE DATABASE database_name;"


Create Database Syntax:

CREATE DATABASE database_name;

Let us see a few examples of different ways in which you can create one,


Example 1: Using the mysql prompt in Terminal

    on macOS/Linux/Windows:

    mysql> Create Database mydb1;

Example 2: Using MySQL Workbench
    1. Open MySQL Workbench.
    2. In a Query Tab, enter the command:
      Create Database mydb2;
    3. Click on the execute icon.
      Create Database using MySQL Workbench
    4. The logs will look like this,
      02:08:15 Create Database mydb2	1 row(s) affected	0.0061 sec
    5. Go to Schema tab and hit the refresh icon and you should see the newly created database.
Refresh the Schema tab to see created MySQL Database

Comments & Discussion

Facing issues? Have questions? Post them here! We're happy to help!