Create a database

更新时间:
复制 MD 格式

Before you can write data or run queries, you must create a database. You can use Data Management Service (DMS) to create a database.

Limits

Each ApsaraDB for ClickHouse cluster supports up to 256 databases.

Prerequisites

Complete the following steps described in the Quick Start guide:

Procedure

  1. Log in to the DMS console, connect to your database, and open the SQL Console page.

  2. Enter a CREATE DATABASE statement.

    • Syntax:

      CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER default];
    • Parameters:

      db_name: The database name. Must start with a lowercase letter, contain only letters, digits, and underscores (_), and be 64 characters or fewer. Consecutive underscores are not allowed.

      Note

      The database name cannot be system because system is a built-in database.

    • Example:

      create database if not exists clickhouse_demo ON CLUSTER default; 
  3. In the upper-left corner, click Execute to create the database.

Next steps

Create a table