PGError (could not connect to server: No such file or directory. Is the
server running locally and accepting connections on Unix domain socket
“/tmp/.s.PGSQL.5432”?
很久以前,我安装PostgreSQL与Homebrew,并尝试安装MongoDB最近我的PostgreSQL安装从来没有过相同。我运行的是OS X v10.6 Snow Leopard。
有什么问题,我如何更好地了解PostgreSQL是如何和应该在我的Mac上设置?
到目前为止(我想)这告诉我PostgreSQL没有运行(?)。
ps -aef|grep postgres (ruby-1.9.2-p320@jct-ana) (develop) ✗ 501 17604 11329 0 0:00.00 ttys001 0:00.00 grep postgres
但是这是否告诉我PostgreSQL正在运行?
✪ launchctl load -w /usr/local/Cellar/postgresql/9.1.4/homebrew.mxcl.postgresql.plist (ruby-1.9.2-p136) homebrew.mxcl.postgresql: Already loaded
我该如何解决?我没有看到什么?
PS:〜/ Library / LaunchAgents包含两个PostgreSQL .plist文件。我不知道这是否相关。
org.postgresql.postgres.plist homebrew.mxcl.postgresql.plist
我试过下面的结果如下。
$ psql -p 5432 -h localhost
psql: could not connect to server: Connection refused Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432? could not connect to server: Connection refused Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? could not connect to server: Connection refused Is the server running on host "localhost" (fe80::1) and accepting TCP/IP connections on port 5432?
我读过,因为这是发生,因为OS X安装自己的版本的PostgreSQL和Homebrew安装不同的版本在不同的地方,PostgreSQL命令在/ tmp /目录中查找。你需要搜索更多的Stack Overflow,但基本上你符号链接PostgreSQL,以便任何东西在tmp路径实际找到真正的路径,如果这是有道理的。
这是链接,我发现了几个更多的东西,特别是做上面的符号链接,Mac OSX Lion Postgres does not accept connections on /tmp/.s.PGSQL.5432.我仍然希望有人会把一个正确的解释在OS X上安装PostgreSQL的概念,为什么它是如此困难。
最新见解,有助于排查问题:
$ which psql // This tells you which PostgreSQL you are using when you run $ psql.
然后运行:
$ echo $PATH
要考虑的关键是:
确保PostgreSQL副本的路径条目要在OS X系统的PostgreSQL的路径之前运行COMES。
这是一个核心要求,决定哪些PostgreSQL运行,是我被告知导致大多数这些问题。
删除此和启动服务器。
检查 – https://github.com/mperham/lunchy是launchctl的一个伟大的包装。