Updated on 2025-07-24 GMT+08:00

Creating a Database

This section describes the basic syntax and usage of the SQL statements for creating a database in a Doris cluster.

Basic Syntax

CREATE DATABASE [IF NOT EXISTS] db_name
[PROPERTIES ("key"="value", ...)];

Usage Example

  1. Connect to Doris through the MySQL client as a user with Doris administrator permissions.
  2. Run the following command to create the example_db database:

    create database if not exists example_db;

  3. Run the following statement to view the database information:

    SHOW DATABASES;
    mysql> SHOW DATABASES;
    +--------------------+
    | Database           |
    +--------------------+
    | example_db         |
    | information_schema |
    +--------------------+
    2 rows in set (0.00 sec)

  4. Run the following command to switch to example_db:

    use example_db;