2

I just installed postgres (with brew) and started it with pg_ctl -D /usr/local/var/postgres -l logfile start

I now try to connect to it in the terminal but get the following:

Connection to PostgreSQL - postgres@localhost failed FATAL: role "me" does not exist

The issue might be that I first installed postgres.app and then didn't get it work right and then removed it.

4
  • The account you should be using initially is postgres and it should not require a password. Commented Jul 15, 2016 at 16:32
  • I run 'su postgres' then initdb /usr/local/var/postgres9.5 -E utf8 but I get creating directory /usr/local/var/postgres9.5 ... initdb: could not create directory "/usr/local/var/postgres9.5": Permission denied Commented Jul 16, 2016 at 8:42
  • for some reason when I run initdb I got the var/postgres dir created with user root Commented Jul 16, 2016 at 8:44
  • actually, I just checked the users on my mac, I have a postgresql user, I think its because I started with postgres.app and then switched to brew and it just confused things, not sure what to do now @Nicarus Commented Jul 16, 2016 at 8:46

1 Answer 1

3
+100

You don't show what you typed and as which user you did it, but from the error message I'd say that you should add -U postgres to the psql invocation.

Sign up to request clarification or add additional context in comments.

5 Comments

enjoy the easiest bounty ever.. probably
Well, if it did the trick for you, that's mission accomplished. If not, please tell me more details.
I can award in 15hrs
for some reason I am now getting FATAL: role "postgres" does not exist any easy way to resolve?
Did you DROP USER postgres or something? If you have no superuser in the database, you'll have to stop the server, start it in single user mode as described here, then look with SELECT * FROM pg_authid and recreate the user if necessary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.