You can use the command-line tool of ClickHouse, Data Management (DMS), or another client such as DataGrip or DBeaver to connect to an ApsaraDB for ClickHouse cluster. Then, execute the CREATE DATABASE statement to create a database.

Background information

In the following example, DMS is used to create a database.

Note You can create up to 256 databases in each ApsaraDB for ClickHouse cluster.

Procedure

  1. On the SQL Server command line, enter the create database statement to create a database.
    • Syntax: CREATE DATABASE [IF NOT EXISTS] $db_name [ON CLUSTER default]
    • Parameter description: db_name: the database name. A database name can be up to 64 characters in length and can contain letters, digits, and underscores (_). The name must start with a lowercase letter and cannot contain consecutive underscores (_).
      Note The database name cannot be system, which is the name of the built-in database.
    • Examples:
      create database clickhouse_demo [ON CLUSTER default];                          
      create database if not exists clickhouse_demo2 [ON CLUSTER default];                         
  2. In the upper-left corner, click execute(F8). The database is created.