# 516: AUTHENTICATION_FAILED (code 516)

> The user name, password, certificate or Kerberos identity did not check out at login.

Source: https://sqlly.app/errors/clickhouse/authentication-failed
Last updated: 2026-11-30
License: Text and data [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) (credit SQLly, sqlly.app); code and SQL snippets [MIT](https://opensource.org/license/mit). [Details](https://sqlly.app/license).
Note: Quoted error message text belongs to its database vendor.

- Error code: `516`
- Name: `AUTHENTICATION_FAILED`
- Category: Authentication and access

Error message:

```text
{user}: Authentication failed: password is incorrect, or there is no user with such name
```

## What it means

`AUTHENTICATION_FAILED` (516) is the modern ClickHouse login failure. It covers a wrong password and an unknown user with one message by design, so the error does not leak which of the two failed. Older or other errors you may see alongside are `UNKNOWN_USER` (192) and `WRONG_PASSWORD` (193).

## Common causes

- The password is wrong, was rotated, or the app config still holds an old value.
- The user does not exist on that server, for example a replica without replicated access control synced.
- The user exists but its auth type (no_password, certificate, Kerberos) does not match how the client connected.

## How to fix it

1. Confirm the user and its auth type on the server you reached.

   ```sql
   SELECT name, auth_type FROM system.users;
   ```
2. Reset the password if rotation broke it.

   ```sql
   ALTER USER app_user IDENTIFIED BY 'new_password';
   ```
3. Test the credentials from the client host to rule out the wrong server.

   ```sql
   clickhouse-client --host my_host --user app_user --password
   ```

## Reproduce it safely

```sql
CREATE USER scratch_u IDENTIFIED BY 'pw'; then clickhouse-client --user scratch_u --password wrong returns 516.
```

## How SQLly helps

SQLly's connection test tells a server that answered and rejected the login from one that was never reached, before you retest by hand.

## Questions

### Why does the message not say whether the user exists?

On purpose. A single message stops attackers from enumerating user names.

### Users vanish after restart?

They were defined in a local access control file while other replicas use replicated access control; align the user_directories configuration across the replicas so each node reads the same store. The access_management setting does not select storage; it grants SQL-driven access control and account management to a user.

## Related errors

- [`164`](https://sqlly.app/errors/clickhouse/readonly): READONLY (code 164)
- [`202`](https://sqlly.app/errors/clickhouse/too-many-simultaneous-queries): TOO_MANY_SIMULTANEOUS_QUERIES (code 202)

The code and message text are from the [ClickHouse documentation (system.errors)](https://clickhouse.com/docs/en/operations/system-tables/errors).
