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.
In the following example, DMS is used to create a database.
- On the SQL Server command line, enter the
create databasestatement to create a database.
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.
create database clickhouse_demo [ON CLUSTER default];
create database if not exists clickhouse_demo2 [ON CLUSTER default];
- In the upper-left corner, click execute(F8). The database is created.