su postgres: Sorry? [closed]
Asked Answered
M

2

22

i have a problem with my postgreSQL setup on my new Mac OSX Lion machine.

I can't seem to connect to the service

$ createuser -a -d _postgres
Password: 
createuser: could not connect to database postgres: FATAL:  password authentication failed for user 

I have no chance to find the correct password. Any idea what could that be. I have the default setup with a localhost server. The same happens when I try to connect via pgAdmin.

$ su postgres
Password:
su: Sorry

I have no chance to find out what's wrong?

Mcneill answered 14/10, 2011 at 8:58 Comment(4)
Is FATAL: password authentication failed for user the reason?Roslyn
no, id don't think so. I typed my userpass a 100 times. It's always the same message. And I don't think in this case I should enter the userpass, but rather the database password!Mcneill
It's just silly to suggest that this isn't on topic.Simper
I posted the equivalent of this Question on the DBA Stack Exchange: Switch user to 'postgres' user on macOS results in “su: Sorry” errorGeorganngeorge
S
67

try this:

$ sudo su postgres

And specify your own password.

Subduct answered 14/10, 2011 at 9:6 Comment(4)
this does work! bash-3.2$ However how can I fix the problem with createuser -a -d _postgres -> `could not connect to database postgres: FATAL: password authentication failed for user "postgres" Any idea how to fix this?Mcneill
Usually when you are logged in as postgres, you have superuser access to the database and doesn't need to provide the password for the postgres user.Subduct
I came from running this tutorial: community.rackspace.com/products/f/25/t/6800 where a postgres is installed and one is asked to login "su - postgres" which asked for a password which in fact does not exist. So sudoing helped: "sudo su - postgres"Kaliningrad
Thanks so much for this huge tip! I posted the same info on DBA Stack Exchange.Georganngeorge
P
12

Does this work?

First get root access

$ su - 
Password: RootPW
# su - postgres
Pyriphlegethon answered 14/10, 2011 at 9:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.