tchaymore
tchaymore

Reputation: 3726

Postgresql socket error when running Django's syncdb (mac OS 10.7.5)

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:

(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.

Upvotes: 0

Views: 1014

Answers (2)

tchaymore
tchaymore

Reputation: 3726

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

Upvotes: 1

mossplix
mossplix

Reputation: 3865

your database is not running try

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

assuming thats where your postgre data directory is

Upvotes: 0

Related Questions