All Products
Search
Document Center

ApsaraDB for ClickHouse:Connect to a cluster using the command line interface

Last Updated:Mar 09, 2026

This topic describes how to use the ClickHouse command line interface 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 password. For more information, see Create an account.

  • Install the clickhouse-client tool that matches the version of your ApsaraDB for ClickHouse cluster. To download the tool, see clickhouse-client.

  • If the server where the clickhouse-client is installed is not in the same VPC as the ApsaraDB for ClickHouse cluster, you must request a public endpoint for the ApsaraDB for ClickHouse cluster. For more information, see Request and release public endpoints.

  • The IP address of the server where the clickhouse-client is installed has been added to the whitelist of ApsaraDB for ClickHouse. For more information, see Set a whitelist.

Procedure

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

  2. Execute 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 endpoint or VPC endpoint. You can view the public endpoint or VPC endpoint on the Cluster Information page.

    Note

    If the server that hosts clickhouse-client is in the same VPC as the ApsaraDB for ClickHouse cluster, we recommend that you use the VPC address to connect. If they are not in the same VPC, we recommend that you use the public endpoint to connect.

    port

    The TCP port number. You can view the TCP port number on the Cluster Information page.

    user

    The database account.

    password

    The password of the database account.