Skip to main content

How to Create a Database

Besides using the panel, you can also create a database directly from HeidiSQL. Make sure you have connected to the database first.

Method 1: Via the Menu (GUI)

  1. In the connection list in the left panel, right-click on your session/server name.
  2. Select Create newDatabase.
  3. Fill in:
    • Database name: the database name (example: db_toko). Only letters, numbers, and underscores (_).
    • Charset: utf8mb4
    • Collation: utf8mb4_general_ci
  4. Click OK.

Creating a new database via the menu

The new database will appear in the left panel and is ready to use.

Method 2: Via an SQL Query

  1. Open the Query tab.
  2. Run the following command:
CREATE DATABASE `db_toko`
CHARACTER SET utf8mb4
COLLATE utf8mb4_general_ci;
  1. Click Run (or press F9).

Running the CREATE DATABASE command

tip

Use the utf8mb4 charset so the database can safely store emoji characters and various languages.


Next Steps