【发布时间】:2012-02-26 09:05:45
【问题描述】:
自从将 OSX 升级到 10.7.3 版本后,当我尝试运行 Django“syncdb”命令时,我从 Postgresql 8.4.2 收到以下 psycopg2 错误:
psycopg2.OperationalError: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
我可以毫无问题地打开 psql,但是当我尝试运行“pg_ctl status”时,我也收到了这个错误:
pg_ctl: could not open PID file "/Library/PostgreSQL/8.4/data/postmaster.pid": Permission denied
有关联吗?
【问题讨论】:
-
pg_ctl 是一个单独的问题,它必须以 postgres 用户身份运行,否则无法访问 pid 文件。当您运行 psql 时,您是否使用 -h 指定主机或 ip?
-
不,我没有指定主机。在 10.7.3 之前,我从来不需要。
-
我注意到在我的“psql -U postgres mydatabase”命令中添加“-h localhost”可以解决这个问题。在这方面有什么想法吗?
标签: django postgresql psycopg2 syncdb