Merge pull request #46730 from ClickHouse/evillique-patch-1

Ask for the password in clickhouse-client interactively
This commit is contained in:
Alexey Milovidov 2023-02-23 08:05:08 +03:00 committed by GitHub
commit 164c0c9927
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -327,7 +327,21 @@ try
showClientVersion();
}
connect();
try
{
connect();
}
catch (const Exception & e)
{
if (e.code() != DB::ErrorCodes::AUTHENTICATION_FAILED ||
config().has("password") ||
config().getBool("ask-password", false) ||
!is_interactive)
throw;
config().setBool("ask-password", true);
connect();
}
/// Show warnings at the beginning of connection.
if (is_interactive && !config().has("no-warnings"))