Postgres: Permission denied for all but phpPgAdmin
Just installed OS X Server for Lion. I'd heard that the default database is now Postres - which is good news. Bad news - I can't connect to it.
I've tried using psql, createdb and Navicat, and all return the same thing: "Could not connect to server: Permission denied." This is using the _postgres role and using my own role which I've added as a superuser to postgres.
The weird thing is, phpPgAdmin开发者_运维技巧 has no trouble at all in connecting. Neither do I when I'm running as root and use psql -U
. But if I just straight up pqsl postgres
or createdb whatever
then it flat-out refuses to work.
Here's a summary:
gormster$ psql postgres # permission denied
gormster$ createdb whatever # permission denied
gormster$ sudo psql postgres # role "root" does not exist
gormster$ sudo su -
root# psql postgres # role "root" does not exist
root# psql -Ugormster postgres # THIS WORKS
What is going on?
Nevermind, it magically started working again. Not sure what it is I did to get it to happen, but it may have been adding myself to the _postgres group. If you're unaware, there are instructions for adding yourself to a group here.
精彩评论