Hi Benjamin,

If you are still not able to locate pg_hba.conf then please try to find it
using find command. Here is a sample on my mac machine.

find /Library/PostgreSQL -name pg_hba.conf
/Library/PostgreSQL/14/data/pg_hba.conf

Ensure that you have permissions to edit this file.

Once you are able to open and edit this file then you may replace (
*scram-sha-256* with *trust) *for the user*.* You will be able to login
without a password. Set new password and then revert back the changes in
pg_hba.conf file to keep PostgreSQL secure.

Sample from pg_hba.conf given below

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all
scram-sha-256
# IPv4 local connections:
host    all             all             127.0.0.1/32
 scram-sha-256


Regards,
Muhammad Ikram



On Mon, Aug 5, 2024 at 9:36 AM Khushboo Vashi <
khushboo.va...@enterprisedb.com> wrote:

> Hi,
>
> On Fri, Aug 2, 2024 at 4:50 PM Benjamin Lund <bl...@student.unimelb.edu.au>
> wrote:
>
>> Hi there,
>>
>>  I have recently created an account on pgAdmin 4 as part of a university
>> course. After making a server with this account and password, I then went
>> to reopen this server a few days later only to realise I needed my password
>> which I have sadly forgotten.
>>
> If you forgot the pgAdmin password, then the Forgot Password link is there
> on the login page.
> If you forgot your PostgreSQL password, then as mentioned by you, find the
> pg_hba file and do appropriate changes to login without password, you will
> find many blogs/videos for that.
>
>>
>> I have looked online for help, but I am unable to find the mentioned
>> 'pg_hba' file that I need. For reference I am working on Mac.
>>
>> Is there any other way I can reset this password and gain access to the
>> server? I have also tried uninstalling the application but this has not
>> solved the issue and when reinstalled it is still attached to my
>> account/password.
>>
> How have you installed Postgres?
>
>>
>> Thanks,
>>
>> Ben
>>
>

-- 
Muhammad Ikram

Reply via email to