Skip to main content
If you don’t like how clickhouse client and clickhouse-local display the prompt in your terminal window, it is possible to change it to add a prefix. This article explains how to change the prompt to whatever you want. The default prompt is your local computer name followed by :) :
Default ClickHouse client prompt
The following are variables that you can use in a prompt: {user}, {host} There are several ways to update the prompt and we’ll go through them each.

--prompt flag

The first way to change the flag is using the --prompt:
This will add the finger emoji before the smiley face:
ClickHouse client prompt with finger emoji

Config file - top level

Alternatively, you can provide a prompt prefix in a config.xml file:
ClickHouse client prompt with config file
We can use a config file with any name we like and pass it in using the -C flag:
ClickHouse client prompt with Christmas tree emoji
Prefer your config files to be in YAML? That works too:
ClickHouse client prompt with yellow circle emoji

Config file - connections_credentials

Alternatively, you can specify a prompt per connection credentials. This only makes sense when using clickhouse-client.
We can then try to connect with the dev connection:
ClickHouse client prompt with development connection
Or the prod one:
ClickHouse client prompt with production connection
And here’s a YAML version:
With the dev connection:
ClickHouse client prompt with development connection using YAML
And now prod:
ClickHouse client prompt with production connection using YAML