ClickHouse Ubuntu Terminal Remote Client

How to install the ClickHouse Ubuntu command line client and connect to your Altinity.Cloud cluster.

26 January 2023 · Read time 2 min

Overview - Ubuntu ClickHouse Client

This section covers the installation of the ClickHouse client on the Linux OS Ubuntu 20.04.
After installation, you will be able to run use ClickHouse queries from the terminal.

Updating Ubuntu

  1. Update your Ubuntu OS and confirm the version with the following commands:

    sudo apt-get update
    sudo apt-get upgrade
    lsb_release -a

Installing ClickHouse drivers

To install ClickHouse drivers on Ubuntu 20.04:

  1. Copy and paste each of the following lines to your Ubuntu terminal in sequence:

    sudo apt-get install -y apt-transport-https ca-certificates dirmngr
    sudo apt-key adv --keyserver hkp:// --recv 8919F6BD2B48D754
    echo "deb stable main" | sudo tee /etc/apt/sources.list.d/clickhouse.list
    sudo apt-get update
    sudo apt-get install -y clickhouse-client
    clickhouse-client --version
       ClickHouse client version (official build).

More information

Logging on to your cluster

  1. From the Connection Details, copy and paste the text string to your Ubuntu terminal:

     clickhouse-client -h --port 9440 -s --user=admin --password

ClickHouse terminal response

  1. After you enter your ClickHouse cluster password, you enter the ClickHouse interactive mode.
    ClickHouse prompt example: example-cluster :)

    (test2) user@xubuntu:~$ clickhouse-client -h --port 9440 -s --user=admin --password
    ClickHouse client version (official build).
    Password for user (admin): 
    Connecting to as user admin.
    Connected to ClickHouse server version 22.3.15 revision 54455.
    ClickHouse server version is older than ClickHouse client. 
    It may indicate that the server is out of date and can be upgraded.
    example-cluster :) 

ClickHouse query examples

  1. At the ClickHouse prompt, enter the query command show tables:

    example-cluster :) show tables
    Query id: c319298f-2f28-48fe-96ca-ce59aacdbc43
    │ events       │
    │ events_local │
    2 rows in set. Elapsed: 0.080 sec.
  2. At the ClickHouse prompt, enter the query select * from events:

    example-cluster :) select * from events
    SELECT *
    FROM events
    Query id: 0e4d08b3-a52d-4a03-917d-226c6a2b00ac
    │ 2023-01-04 │          113 │ Example │
    │ 2023-01-10 │          113 │ Example │
    │ 2023-01-10 │          114 │ Example │
    3 rows in set. Elapsed: 0.073 sec.

To quit, or exit from the ClickHouse interactive mode:

  1. Enter the exit command to return to your Ubuntu shell environment.

    example-cluster :) exit

This completes the quick start guide to installing ClickHouse command-line client on an Ubuntu OS.

Related links


Make sure you have the latest ClickHouse client installed to avoid connection issues.


  • Error Code: 210 SSL connection unexpectedly closed.
  • Problem result: Cannot connect to ACM Cluster with clickhouse-client terminal command.
ubuntu@ip-172-31-16-238:~$ clickhouse-client -h --port 9440 -s --user=admin --password=supersecretpassword123

# Error response: note the older version of the ClickHouse client v18.16.1
ClickHouse client version 18.16.1.
Connecting to as user admin.
Code: 210. DB::NetException: SSL connection unexpectedly closed (,

Reason for the error

When you have an outdated version of the ClickHouse client software installed, you may fail to connect to your ACM cluster. The issue may be that a standard apt-get install or apt-get upgrade will not retrieve the latest version of the ClickHouse client as shown in this example terminal listing.

sudo apt install clickhouse-client
# Note the older client
Get:25 focal/universe amd64 clickhouse-common amd64 18.16.1+ds-7 [9266 kB]
Get:26 focal/universe amd64 clickhouse-client amd64 18.16.1+ds-7 [138 kB]

The solution is to follow the instructions on this page:

Last modified 0001.01.01