All Products
Search
Document Center

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

Last Updated:Mar 30, 2026

Use clickhouse-client to connect to an ApsaraDB for ClickHouse cluster from your local machine or server.

Prerequisites

Before you begin, ensure that you have:

Connect to a cluster

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

  2. Run the following command to connect to the cluster:

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

    Replace the placeholders with the appropriate values:

    Parameter Description
    host The endpoint of the cluster. Use the VPC endpoint if the client is in the same VPC as the cluster; use the public endpoint if not. You can view the endpoint on the Cluster Information page.
    port The TCP port number. You can view the TCP port number on the Cluster Information page.
    user The database account.
    password The password for the database account.
  3. Verify that the connection succeeded. A successful connection displays output similar to the following:

    ClickHouse client version <version> (official build).
    Connecting to <host>:<port> as user <user>.
    Connected to ClickHouse server version <version>.
    
    :)

    The :) prompt indicates the connection is active and ready to accept queries.

What's next