v.23.4Improvement

Override CLICKHOUSE_USER and CLICKHOUSE_PASSWORD with client parameters

Override CLICKHOUSE_USER and CLICKHOUSE_PASSWORD environment variables with --user and --password client parameters. Closes #38909. #48440 (Nikolay Degterinsky).
Enable overriding CLICKHOUSE_USER and CLICKHOUSE_PASSWORD environment variables with the --user and --password client command-line parameters.

Why it matters

This feature allows users to explicitly specify the username and password via client parameters, which take precedence over the corresponding environment variables. This improves flexibility and control over authentication when connecting to ClickHouse, especially in automated or scripted environments.

How to use it

When connecting to ClickHouse using a client, specify the username and password directly with the --user and --password parameters respectively. These parameters will override any CLICKHOUSE_USER and CLICKHOUSE_PASSWORD environment variables set in the session. For example:

clickhouse-client --user=my_user --password=my_password