Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am attempting to prompt for a username and password when running a database creation script, and I want to hide any text input for my password prompt. In Oracle's sqlplus, I can use HIDE at the end of the line to suppress the user's input from appearing on the screen. Is there an equivalent for PostgreSQL's psql?

Current progress:

\prompt 'Enter database user password: ' ss_password
share|improve this question
"\password username" will do it for changing a postgres users password. Is that workable in your script? – Phil Apr 15 '13 at 15:17
@Phil - It looks like that will work in my specific case. Thank you! I am still curious, though, if there is a way to suppress the input if I wasn't using the variable for a PostgreSQL user. – ChrisForrence Apr 15 '13 at 15:27
up vote 1 down vote accepted
\password username

... will change the password for a given username, whilst suppressing the inputted password. I don't know of a way to do it for a given variable.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.