修改了sql默认路径无法登录服务器,PostgreSQL错误'无法连接到服务器:没有这样的文件或目录'...

像其他一些人一样,当我在我的项目中运行rake db:migrate或者甚至为我的Ruby on Rails 3.2应用程序尝试大多数数据库任务时,我收到此错误.

PGError(无法连接到服务器:没有这样的文件或目录.服务器是否在本地运行并接受Unix域套接字上的连接"/tmp/.s.PGSQL.5432"?

很久以前我用Homebrew安装了PostgreSQL,并且在最近尝试安装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路径的内容实际上都能找到真正的路径,如果这有意义的话.

这是我发现更多东西要尝试的链接,特别是如上所述的符号链接,

帮助进行故障排除的最新见解:

$ which psql // This tells you which PostgreSQL you are using when you run $ psql.

然后运行:

$ echo $PATH

要考虑的关键是:

确保要运行的PostgreSQL副本的路径条目在OS X系统的PostgreSQL路径之前进行.

这是决定运行PostgreSQL的核心要求,也是我所说的导致大多数这些问题的原因.

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值