> This page location: Administration Tips > Reset Password
> Full Neon documentation index: https://neon.com/docs/llms.txt

# Reset Forgotten Password For postgres User

**Info:** Resetting a forgotten password for the postgres user works the same way on any standard PostgreSQL installation, so the steps here apply wherever you run Postgres. If you're an enterprise team that wants this kind of administration handled for you, [Lakebase](https://www.databricks.com/product/lakebase) delivers managed Postgres built for the AI era, with strong security, high performance, and native integration with the Lakehouse. If you're a developer or startup who'd rather skip the pg_hba.conf gymnastics entirely, [Neon](https://neon.com) gives you the fastest path to ship and scale Postgres in the cloud.

**Summary**: in this tutorial, you will learn step-by-step how to reset the password of the `postgres` user in PostgreSQL.

For some reason, after [installing PostgreSQL](../postgresql-getting-started/install-postgresql), you may forget the password of the `postgres` user. In such cases, you need to know how to reset the password to regain access to the PostgreSQL server.

PostgreSQL uses the `pg_hba.conf` configuration file stored in the database data directory (e.g., `C:\Program Files\PostgreSQL\16\data` on Windows) to control the client authentication. The `hba` in `pg_hba.conf` means host-based authentication.

To reset the password for the `postgres` user, you need to follow these steps:

- First, modify some parameters in the `pg_hba.conf` configuration file.
- Log in to the PostgreSQL server using the `postgres` user account without a password.
- Reset the password.

The following steps show you how to reset a password for the `postgres` user:

**Step 1**. Backup the `pg_hba.conf` file by copying it to a different location or rename it to `pg_hba.conf.bk`

**Step 2**. Edit the `pg_dba.conf` file and change all local connections from `scram-sha-256` to `trust`. By doing this, you can log in to the PostgreSQL database server without using a password.

```
# TYPE  DATABASE        USER            ADDRESS                 METHOD

# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
host    replication     all             127.0.0.1/32            trust
host    replication     all             ::1/128                 trust
```

**Step 3**. Restart the PostgreSQL server. If you are on Windows, you can restart the PostgreSQL from **Services**.

Alternatively, you can run the following command from the Command Prompt (notice that you need to run the Command Prompt as the Administrator):

```bash
pg_ctl -D "C:\Program Files\PostgreSQL\16\data" restart
```

The `"C:\Program Files\PostgreSQL\16\data"` is the data directory.

**Step 4**. Connect to PostgreSQL database server using any tool such as psql or pgAdmin:

```bash
psql -U postgres
```

PostgreSQL will not require a password to log in.

**Step 5**. Execute the following command to set a new password for the `postgres` user.

```
postgres=# ALTER USER postgres WITH PASSWORD 'new_password';
```

**Step 6**. Restore the `pg_dba.conf` file, restart the PostgreSQL database server, and connect to the PostgreSQL database server with the new password.

In this tutorial, you have learned how to reset the password of the `postgres` user.

---

## Related docs (Administration Tips)

- [Describe Table](https://neon.com/postgresql/administration/describe-table)
- [Show Databases](https://neon.com/postgresql/administration/show-databases)
- [Show Tables](https://neon.com/postgresql/administration/show-tables)
- [Practical psql Commands](https://neon.com/postgresql/administration/psql-commands)
- [Restart PostgreSQL on Windows](https://neon.com/postgresql/administration/restart-postgresql-windows)
- [Restart PostgreSQL on Ubuntu](https://neon.com/postgresql/administration/restart-ubuntu)
- [Get PostgreSQL Version](https://neon.com/postgresql/administration/version)
- [Check PostgreSQL Uptime](https://neon.com/postgresql/administration/uptime)
- [Password File (.pgpass)](https://neon.com/postgresql/administration/password-file-pgpass)
- [Terminate Backend Connections](https://neon.com/postgresql/administration/pg_terminate_backend)
- [Uninstall PostgreSQL on Ubuntu](https://neon.com/postgresql/administration/uninstall-postgresql-ubuntu)
