Re: psql - prompt for password - Mailing list pgsql-admin

From Erik Wienhold
Subject Re: psql - prompt for password
Date
Msg-id 822d3df1-9ec9-4cbb-922a-c7ac0cff424d@ewie.name
Whole thread Raw
In response to psql - prompt for password  (Edwin UY <edwin.uy@gmail.com>)
List pgsql-admin
On 2024-05-30 10:07 +0200, Edwin UY wrote:
> Is createuser the only one I can use to create a user where it prompts for
> a password? There is no alteruser though.
> I want to use psql and \prompt but am lost on how to use it.
> Basically just want to use it for running a psql script like for example -
> ALTER USER spongebob WITH ENCRYPTED PASSWORD ':newpassword';

Or use \password which has the benefit of not leaking the plaintext
password into the logs which would be the case if there's an error in
the ALTER USER command.

    psql -c '\password spongebob'

-- 
Erik



pgsql-admin by date:

Previous
From: Kashif Zeeshan
Date:
Subject: Re: psql - prompt for password
Next
From: Mohan NBSPS
Date:
Subject: Re: Postgresql 9.5: Streaming Replication: Secondaries Fail To Start Post WAL Error