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

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap