# The database refused a login with a wrong user or password

A plugin or mod tried to log in to a MySQL or PostgreSQL database with a user or password the database does not accept, so it cannot use the database.

- Code: `database_auth_failed`
- Severity: error
- Category: Databases
- Server types: MySQL, PostgreSQL
- Page: https://failures.perland.online/failures/database_auth_failed/

## Example log

```text
2026-11-02 18:22:41.093 UTC [214] FATAL:  password authentication failed for user "luckperms"
2026-11-02 18:22:41.093 UTC [214] DETAIL:  Connection matched file "/var/lib/postgresql/data/pg_hba.conf" line 100: "host all all all scram-sha-256"
2026-11-02 18:22:46.117 UTC [215] FATAL:  password authentication failed for user "luckperms"
```

## Parameters

| Parameter | Meaning |
| --- | --- |
| `database` | Which database printed it, `mysql` or `postgres`. |
| `user` | The user name the client tried to log in as. |

## Log lines this page covers

- `Access denied for user`
- `password authentication failed for user`
- `no pg_hba.conf entry for host`

## What it means

The database is running and reachable, but it turned a client away at login. Some program connected (almost always a plugin or mod of the Minecraft server, such as a permissions, economy or logging plugin) and gave a user name or password the database does not accept.

The database itself is fine and other clients with the right details keep working. Only the program that sent the wrong details cannot use it, so it usually fails to enable, falls back to local files, or keeps retrying and printing errors in the Minecraft server's own log.

## Why it happens

- **The password in the plugin's or mod's config is wrong**, or still the example value of its default config.
- **The user name is wrong**, or the user does not exist in the database (PostgreSQL says so in the line after: `Role "…" does not exist`).
- **The database's password was changed** and the plugin's config was not updated, or the other way round.
- **PostgreSQL does not allow that user from that address** (`no pg_hba.conf entry for host`): its `pg_hba.conf` has no rule matching the client's host, user and database.
- **MySQL:** the user exists only for another host (`'luckperms'@'localhost'` but not `'luckperms'@'%'`), so a connection from another container is refused.

## How to fix

1. Find which plugin or mod connects as the user the line names: search the server's config folder for that user name.
2. Open its config and check the host, port, database name, user and password against the ones the database was created with. Watch for extra spaces and quotes.
3. Restart the Minecraft server (or reload just that plugin, if it supports it) so it reads the new details.
4. If the details are right but the user cannot log in:
   - **MySQL:** list the users with `SELECT user, host FROM mysql.user;` and create or fix the one the plugin needs, with a host that allows its address (such as `%`).
   - **PostgreSQL:** check the user exists with `\du` in `psql`, and add a line to `pg_hba.conf` for that host, user and database if the log says `no pg_hba.conf entry`; then reload the configuration with `SELECT pg_reload_conf();`.

MySQL 8 and later write failed logins to their log only at `--log-error-verbosity=3`, so on MySQL this issue may not show even when logins fail; the plugin's own error in the Minecraft server's log says it too.

## In Perland

A server's database sidecar is a MySQL or PostgreSQL container next to the server, created with its own database, user and password. In Settings, Variables and secrets lists that database's user and password as placeholders (`${CFG_MYSQL_USER}`, `${CFG_POSTGRES_PASSWORD}` and the like) that a plugin's config file in a Git source can use, so the details always match. This issue appears in the sidecar's diagnosis (the stack's diagnosis with `service` `mysql` or `postgres`); Perland's sidecars keep MySQL's default verbosity, so it shows on PostgreSQL sidecars.

## References

- [MySQL 8.4: troubleshooting problems connecting to MySQL](https://dev.mysql.com/doc/refman/8.4/en/problems-connecting.html)
- [PostgreSQL: the pg_hba.conf file](https://www.postgresql.org/docs/current/auth-pg-hba-conf.html)
- [PostgreSQL: authentication problems](https://www.postgresql.org/docs/current/client-authentication-problems.html)
