Postgres User Password?

Doug Easterbrook doug at
Tue Oct 4 18:10:34 UTC 2022

there is a BIG difference between
1) the postgres USER account in linux and 
2) the postgres DATABASE account in the database.

since they have the same name, you need to know which one you are changing.

if you can log into the database via an application or via pgadmin because the pg_hba.conf is set to trust for the local users, then you can easily change the postgres DATABASE password using sql, from any tool, whether it be pgadmin on psql as Andy pointed out.

if you can run the sql, you can change it.

on the other hand, the postgres USER account, in linux — I think the default is blank unless you changed it.

so, try an 
su - postgres

leave the password blank and see if that lets you be the postgres user

if not, then you can be the root user in linux.

I think that is 
sudo -i

and often times people do not set a password on that in an installation.  it might prompt you to set one .. then you can.

if you are the root user, you can bring postgres up and down.    not sure which version of linux you are using.

I’ve used.  

service <servicename> start 

(substitute what you called the service for <servicename>).  I’m not a linux guru, so I have to look these things up myself.  there is a place you can go to get a list of the service names.

finally, there are ways to change passwords on USER accounts in linux if you have permisions.  I think it is the Passwd comand <>

hope that. helps.

but you need to know if you are changing the postgres USER password or the postgres DATABASE password

Doug Easterbrook
Arts Management Systems Ltd.
mailto:doug at
Phone (403) 650-1978

> On Oct 4, 2022, at 10:51 AM, Das Goravani <goravanis at> wrote:
>> On Oct 4, 2022, at 1:33 PM, TBS <andyh at> wrote:
>> Das
>> What is most likely is that no, you did not set a Postgres user password upon installation - but its easy to add one now so all is not lost !!
>> Here is my own note regarding this for Debian :
>> set postgres password with:
>> su - postgres
>> psql
>> ALTER USER postgres WITH PASSWORD '<newpassword>';
>> \q
>> exit
> Trying the above is giving me a hard time.
> When I issue the first line, it asks for the postgres user password
> That’s the problem, my passwords don’t work, neither does using the word postgres admin nothing etc
> It says authentication failure and quits
> So no, this approach is NOT getting me there. Unfortunately.
>> Then restart postgres
>> Let me know if that gets you there
>> Andy Hilton
>> Totally Brilliant Software Inc
>> Phone (US) : (863) 409 4870
>> Phone (UK) : 0207 193 8582
>> Web :
>> Helpdesk :
>> Email : andyh at
>> On Oct 4, 2022, 1:12 PM -0400, Das Goravani <goravanis at>, wrote:
>>> Hello
>>> When I set up my Debian Server with Postgres, I don’t remember giving the Postgres user a password.
>>> Now it is asking me for the password and nothing works.
>>> The thing is I only use two passwords on everything, and neither of them is working.
>>> I’ve tried everything I can think of, and nothing is working.
>>> Is there a default password for the Postgres user?
>>> The user I CAN Log in as is NOT a superuser and cannot create roles.
>>> Postgres could create roles if I could log in as Postgres.
>>> Because I cannot log in as Postgres, and my other user cannot do anything, so am I SCREWED with this postgres installation?
>>> That would be a bummer.
>>> Das
>>> _____________________________________________________________
>>> Manage your list subscriptions at
>>> Start a new message -> mailto:omnisdev-en at
>> _____________________________________________________________
>> Manage your list subscriptions at
>> Start a new message -> mailto:omnisdev-en at 
> _____________________________________________________________
> Manage your list subscriptions at
> Start a new message -> mailto:omnisdev-en at 

More information about the omnisdev-en mailing list