I've seen similar issues posted on here but I can't solve my problem. I've had postgres working for a month and last night it stopped working. I can use psql in the command line to access databases and tables. When I connect to localhost and can view a page I've built. When I try to log in I believe it's the first time using psql and I get an error page with the FATAL message mentioned above. When I open Postgres from spotlight I get the message "There is already a PostgreSQL server running on port 5432". I also see the mssage "Server startup failed" and "You now have a PostgreSQL server running locally." It appears postgres is working, but I don't know why out of the blue I'd get this FATAL message on my localhost9292. Any suggestions/clarification? Thanks
Asked
Active
Viewed 619 times
1 Answers
0
Perhaps the operating system user you are connecting as doesn't have an account in Postgres. Try this: psql -U postgres
Update: current working theory - there is more than 1 Postgres install on the machine, and the default installed one has started instead of the user installed one. That would explain why this was working before, and now does not.

davejagoda
- 2,420
- 1
- 20
- 27
-
Thanks for the response, when I type that I get the same message: "FATAL: role "postgres" does not exist – KM617 Dec 13 '15 at 15:53
-
Any recommendations? When I view all accounts I see my user as role name and attributes includes superuser, create role, create DT, replication. Is it a matter of still not being connected on localhost? – KM617 Dec 13 '15 at 15:59
-
You mentioned Spotlight, which sounds like OS X. Does this SO article help: http://stackoverflow.com/questions/15301826/psql-fatal-role-postgres-does-not-exist – davejagoda Dec 13 '15 at 15:59
-
Thanks, I saw this earlier and did my best but it looks like I have a role with superuser and I believe I'm connected as that user. I still have the same issue on localhost. I think there's a very minot tweak I can't solve but I've run out of ideas and am not to familiar with postgresql. – KM617 Dec 13 '15 at 16:04
-
So are you able to connect using `psql` at all? If so, what output does this produce once connected: `\du`? – davejagoda Dec 13 '15 at 16:09
-
List of roles Role name | Attributes | Member of ----------------+------------------------------------------------+----------- [my user name] | Superuser, Create role, Create DB, Replication | {} – KM617 Dec 13 '15 at 16:11
-
Yes, I'm able to connect with psql, view my databases and query my tables. – KM617 Dec 13 '15 at 16:11
-
I'll assume `my user name` is `KM617` (please substitute your actual user name) and try this: `psql -U KM617` – davejagoda Dec 13 '15 at 16:13
-
I'm able to connect so it says KM617=#... Thanks again for all your help, still getting the FATAL error message – KM617 Dec 13 '15 at 16:15
-
From the SO link, you could create a `postgres` user (caveat: I haven't tried this): `createuser -s postgres`, then whatever is assuming that user exists will work. You could also set the PGUSER environment variable: `export PGUSER=KM617` Make sure that variable is in the environment before running any Postgres commands. – davejagoda Dec 13 '15 at 16:20
-
Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/97775/discussion-between-davejagoda-and-km617). – davejagoda Dec 13 '15 at 16:26