From: | Kashif Zeeshan <kashi(dot)zeeshan(at)gmail(dot)com> |
---|---|
To: | Edwin UY <edwin(dot)uy(at)gmail(dot)com> |
Cc: | pgsql-admin(at)lists(dot)postgresql(dot)org |
Subject: | Re: psql - prompt for password |
Date: | 2024-05-30 08:17:37 |
Message-ID: | CAAPsdheQiazQzBuz9DPo-NuuK1qK3q4ne0nnMFFNow=FW8Vatw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Hi Edwin
You can use \prompt for this reason, following is the example.
You first use the \prompt to get the password and store into a variable
You can then user CREATE USER Command and supply the variable used with
\prompt to provide the password.
I hope this helps.
=# \prompt 'Enter password for new user: ' new_user_password
Enter password for new user: test
# CREATE USER spongebob WITH ENCRYPTED PASSWORD :'new_user_password';
CREATE ROLE
Regards
Kashif Zeeshan
Bitnine Global
On Thu, May 30, 2024 at 1:07 PM Edwin UY <edwin(dot)uy(at)gmail(dot)com> wrote:
> Hi,
>
> 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';
>
> Regards,
> Ed
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Erik Wienhold | 2024-05-30 11:01:54 | Re: psql - prompt for password |
Previous Message | Holger Jakobs | 2024-05-30 08:11:47 | Re: psql - prompt for password |