Codementor Events

PostgreSQL prompts for password before setting one

Published Jun 28, 2017

I have just installed PostgreSQL 9.6.3 via homebrew(brew install postgresql) and am simply trying to run psql. However after entering:

Mac-Pro:~ Travis$ psql

It prompts me to enter a password, which I have never set. I've tried entering my system login password but receive:

Password: psql: FATAL: password authentication failed for user "Travis"

And when entering nothing I get: psql: fe_sendauth: no password supplied

Everything I've found online states there is no password set by default by postgres and yet this is requiring one and I've just installed it. No tutorial I've found mentions what to do if it prompts for password after install, they just jump right into working in postgres(usually creating users and settings passwords). What could this password be if I've never set it up and it's not my system password? And really what I want to know is, how can I get past this and use postgres?

Thank you

Discover and read more posts from Travis Roberts
get started
post commentsBe the first to share your opinion
R G
5 years ago

Type the following:
psql -U postgres

That will switch user to postgres (which you would have set a password for during installation). Read the docs - https://wiki.postgresql.org/wiki/First_steps

deepankar pal
7 years ago

Hi

I came across the same problem. The issue is we are trying to access postgreSQL without starting it. First run the command ‘pg_ctl -D /usr/local/var/postgres start’ from terminal. It wont ask for password then.

Show more replies