App overview screenshotSQL and Database Guides
PostgresMySQLSQLite
Try our free SQL Client
Tools
Connecting to Postgres
Connecting to Drivers
Installing Postgres
Setting up Postgres
Postgres   >   
Setting up Postgres   >   
Reset Password on Windows

How to Reset the Postgres 14 password on Windows

Prerequisites

  • Postgres 14 installed
  • Postgresql GUI like Arctype

Introduction

If you use Windows and have installed Postgres 14, sometimes after installing Postgres 14 you may forget the Postgres user password and need to reset it.

We’ll walk you through the steps to reset your password and get Postgres running again.

With the following steps you will be able to reset your Postgres 14 password:

Step 1

Backup: In your file explorer search for ‘ pg_hba.conf ’ back it up by copying it into a different file.

Check postgres

Step 2

Change all methods: Open ‘ pg_hba.conf ‘ in any code editor and change all the methods of the local connections from ‘ scram-sha-256 ’ to ‘trust’ and save. After this change, you will be able to access your Postgres database server from your command line without entering a password.

From this

Postgres User Permissions

To this

Postgres User Permissions

Step 3

Restart the PostgreSQL server: Go to services, search for PostgreSQL server, click on it, and in the top-left click on Restart the service.

Postgres User Permissions

Step 4

Connect to PostgreSQL database server: Using any PostgreSQL GUIs such as Arctype you can connect to the PostgreSQL database server without entering a password. This can be done by entering the following in your command line.


psql -U postgres

Step 5

Set a new password: Run the following command to set a new Postgres user password.


ALTER USER postgres WITH PASSWORD 'new_password';

Step 6

Restore ‘ pg_dba.conf ‘ to its original state: change all methods from ‘ trust ’ back to ‘ scram-sha-256 ‘.

Step 7

Restart the PostgreSQL server as in step3.

Step 8

Connect to the PostgreSQL database using your new password with Arctype.

Postgres User Permissions

If the password is correct connection successful will pop up

Conclusion and References

In this tutorial, you just learned how to reset your Postgres 14 password. Check out other tutorials on how to do this as well.

Get help on databases and SQL. Join our Discord community.