0

I'm trying to run Django's syncdb operation and am getting the following error:

psycopg2.OperationalError: could not connect to server: Permission denied
    Is the server running locally and accepting
    connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

I've read the answers to this question and have tried the following:

  • changing "listen_address" to "localhost" or "*" in /Library/PostgreSQL/9.1/data/potsgresql.conf
  • changing "host" to "localhost" in my settings.py file (for Django)
  • user is set to "postgres" with correct password in settings.py

(I restarted the postgresql server after each step.)

I've also checked my pg_hba.conf file to see if the Unix domain socket was accepting connections from all users (based on this page). Here's what I have there:

# "local" is for Unix domain socket connections only
local   all             all                                     md5
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5

I never had this problem before. I somewhat recently upgraded to Lion and am working on a new virtualenv with the bare minimum of modules installed.

2
  • Have you tried host all all 127.0.0.1/32 trust? Commented Oct 29, 2012 at 0:51
  • @okm Just gave it a try -- no luck, same response. Commented Oct 29, 2012 at 2:21

2 Answers 2

1

Found the answer courtesy of Bradley Ayers:

  • set "unix_socket_directory" to "/var/pgsql_socket/" in postgres.conf
  • executed following commands:
    • "$ sudo dscl . append /Groups/_postgres GroupMembership postgres"
    • "$ sudo chmod g+w,o+rx /var/pgsql_socket/"
  • restarted postgresql
Sign up to request clarification or add additional context in comments.

Comments

0

your database is not running try

pg_ctl -D /usr/local/var/postgres  start

assuming thats where your postgre data directory is

Comments

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.