最近将我的计算机从Mac OS X Lion(10.7.4)更新为Mountain Lion(10.8),我认为这使我的PostgreSQL安装感到厌烦。它最初是通过Homebrew安装的。我不是DBA,但希望有人可以告诉我如何解决此问题。
我无法连接(但在前山狮之前能够连接):
$ psql -U rails -d myapp_development
psql: 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"?
但是Postgres仍然在运行:
$ ps aux | grep postgres
meltemi 2010 0.0 0.0 2444124 5292 ?? Ss Wed01PM 0:00.02 postgres: rails myapp_development [local] idle
meltemi 562 0.0 0.0 2439312 592 ?? Ss Wed12PM 0:02.28 postgres: stats collector process
meltemi 561 0.0 0.0 2443228 1832 ?? Ss Wed12PM 0:01.57 postgres: autovacuum launcher process
meltemi 560 0.0 0.0 2443096 596 ?? Ss Wed12PM 0:02.89 postgres: wal writer process
meltemi 559 0.0 0.0 2443096 1072 ?? Ss Wed12PM 0:04.01 postgres: writer process
meltemi 466 0.0 0.0 2443096 3728 ?? S Wed12PM 0:00.85 /usr/local/bin/postgres -D /usr/local/varpostgres -r /usr/local/var/postgres/server.log
而且它正在响应来自本地Rails应用程序的查询(测试数据库和开发数据库)
User Load (0.2ms) SELECT "users".* FROM "users"
Rendered users/index.html.haml within layouts/application (1.3ms)
似乎没有/var/pgsql_socket/
目录,更不用说/var/pgsql_socket/.s.PGSQL.5432
上面提到的套接字文件了!也许安装Mountain Lion可以消除这种情况?
$ ls -l /var/ | grep pg
drwxr-x--- 2 _postgres _postgres 68 Jun 20 16:39 pgsql_socket_alt
我该如何解决?
/usr/local/var/postgres/server.log
?
$PATH
升级/usr/bin
前的变化已经提前,/usr/local/bin
我认为Mountain Lion可能预装了PostgreSQL !!!正在调查...