All Products
Search
Document Center

ApsaraDB for ClickHouse:Connect to a ClickHouse cluster by using the CLI

Last Updated:Jul 17, 2026

You can use the clickhouse-client to connect to an ApsaraDB for ClickHouse cluster.

Prerequisites

  • You have created an ApsaraDB for ClickHouse cluster. For more information, see Create a cluster.

  • You have created a database account and a password. For more information, see Create an account.

  • You have installed a compatible version of the clickhouse-client. For the download link, see clickhouse-client.

  • If the clickhouse-client server is not in the same VPC as the ApsaraDB for ClickHouse cluster, apply for a public endpoint first. For more information, see Apply for and release a public endpoint.

  • You have added the IP address of the server running the clickhouse-client to the ApsaraDB for ClickHouse whitelist. For more information, see Configure a whitelist.

Procedure

  1. Log on to the server where the clickhouse-client is installed.

  2. Run the connection command to connect to the ApsaraDB for ClickHouse cluster. The syntax is as follows.

    clickhouse-client --host=<host> --port=<port> --user=<user> --password=<password> 

    The following table describes the parameters.

    Parameter

    Description

    host

    The public or internal endpoint of the cluster. You can find the endpoint on the Cluster Information page.

    Note

    If the server running the clickhouse-client and the ApsaraDB for ClickHouse cluster are in the same VPC, use the internal endpoint. Otherwise, use the public endpoint.

    port

    The TCP port number, available on the Cluster Information page.

    user

    The database account.

    password

    The password for the database account.