Before you write and query data, you must create a database. This topic describes how to use Data Management (DMS) to create a database.
You can create up to 256 databases in each ApsaraDB ClickHouse cluster.
- Create a cluster
- Create an account
- Configure a whitelistNote When you create an ApsaraDB ClickHouse cluster, the system automatically adds a whitelist named dms for the ApsaraDB ClickHouse cluster and adds the IP addresses of DMS servers to the whitelist. If the whitelist fails to be added, you must manually add the whitelist. For information about the IP addresses of DMS servers in different regions, see DMS IP addresses and CIDR blocks.
- Connect to a cluster
- On the SQL Console page in the DMS console, execute the CREATE DATABASE statement to create a database.
CREATE DATABASE [IF NOT EXISTS] db [ON CLUSTER default]
- Parameter description:
db_name: the name of the database. A database name can be up to 64 characters in length and can contain letters, digits, and underscores (_). The database name must start with a lowercase letter and cannot contain consecutive underscores (_).Note You cannot use the word system as the database name because system is reserved as the name of the built-in database. For more information, see CREATE DATABASE.
create database if not exists clickhouse_demo ON CLUSTER default;
- In the upper-left corner, click execute(F8). The database is created.