Mountain Lion Postgres无法连接

Ane*_*pos 11 postgresql postgresql-9.1 osx-mountain-lion

我更新到山狮后,我的postgres doest工作.它仍在运行,但我的应用程序无法再连接到它.

$ ps aux | grep postgres
postgres         204   0.0  0.0  2446960    836   ??  Ss    7:31AM   0:00.59 postgres: stats collector process    
postgres         203   0.0  0.1  2478732   2240   ??  Ss    7:31AM   0:00.41 postgres: autovacuum launcher process    
postgres         202   0.0  0.0  2478600    584   ??  Ss    7:31AM   0:00.34 postgres: wal writer process    
postgres         201   0.0  0.0  2478600    784   ??  Ss    7:31AM   0:00.48 postgres: writer process    
postgres          95   0.0  0.0  2446960    368   ??  Ss    7:31AM   0:00.11 postgres: logger process    
postgres          64   0.0  0.2  2478600   7972   ??  Ss    7:31AM   0:00.26 /Library/PostgreSQL/9.1/bin/postmaster -D/Library/PostgreSQL/9.1/data
anezio         10205   0.0  0.0  2432768    624 s000  R+    8:01AM   0:00.00 grep postgres
Run Code Online (Sandbox Code Playgroud)

我的应用程序返回此错误:

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"?
Run Code Online (Sandbox Code Playgroud)

我仍然可以使用命令/Library/PostgreSQL/9.1/bin/psql -U postgres连接到psql

似乎有些东西没有指向正确的地方

Nei*_*ham 8

我刚遇到同样的问题.我个人刚从Postgres安装程序重新安装(在我的情况下是postgresql-9.1.3-1-osx.dmg),重新启动我的mac,一切都很好.ps重新安装没有消除我的数据库:)


小智 5

检查psql您正在使用的是哪个.我在使用Heroku 的Postgres.app服务器时遇到了同样的问题,发现我/usr/bin/psql根据我的$PATH设置使用了Apple的客户端.将您设置$PATH为使用Postgres库或使用已安装的完整路径psql.

  • 我在brew位置/ usr/local/bin安装了postgres.我已将/ etc/paths更改为将/ usr/local/bin放在搜索路径的顶部,以便首先找到brew安装(在/ usr/bin安装之前).升级到Mountain Lion会重置/ etc/paths的内容; 因此,我也开始在升级后接收/ usr/bin中的苹果安装的psql(以及令人讨厌的消息"无法连接到服务器......").将/ usr/local/bin放回/ etc/paths的顶部修复了所有内容. (2认同)

Ane*_*pos 0

我已经通过卸载并重新安装解决了这个问题