You must create a database before you can write and query data. This topic describes how to create a database using Data Management Service (DMS).
Limits
You can create up to 256 databases in each ApsaraDB for ClickHouse cluster.
Prerequisites
You have completed the following steps in the Quick Start guide.
- Note
When you create an ApsaraDB for ClickHouse cluster, the system automatically adds a whitelist group named ali_dms_group for the ApsaraDB for ClickHouse cluster and populates the group with the IP addresses of DMS servers. If the group is not added automatically, you must add it manually. For a list of DMS server IP addresses for each region, see DMS IP address ranges.
Procedure
Log on to the DMS console and go to the SQL Console page.
Enter the CREATE DATABASE statement.
Syntax:
CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER default];Parameters:
db_name: The name of the database. The name must start with a lowercase letter and can be up to 64 characters in length. It can contain letters, digits, and underscores (_). The name cannot contain consecutive underscores (_).NoteDo not use system as the database name because it is the name of the built-in database.
Example:
create database if not exists clickhouse_demo ON CLUSTER default;
In the upper-left corner, click Execute. The database is created.