升级到OSX 10.7 Lion后修复Postgresql [英] Repairing Postgresql after upgrading to OSX 10.7 Lion

查看:79
本文介绍了升级到OSX 10.7 Lion后修复Postgresql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近升级到OSX 10.7,这时尝试连接到psql服务器时,我的rails安装完全失败了.当我使用

I recently upgraded to OSX 10.7, at which point my rails installation completely borked when trying to connect to the psql server. When I do it from the command line using

psql -U postgres

它完全可以正常工作,但是当我尝试使用相同的用户名和密码运行Rails服务器或控制台时,出现此错误

it works totally fine, but when I try to run the rails server or console with the same username and password, I get this error

...activerecord-3.0.9/lib/active_record/connection_adapters/postgresql_adapter.rb:950:in `initialize': could not connect to server: Permission denied (PGError) 
Is the server running locally and accepting
    connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

任何想法可能会发生的事情都将非常有帮助!谢谢!

Any ideas what might be going on would be super helpful! Thanks!

推荐答案

这是PATH问题. Mac OSX Lion现在在系统中包含Postgresql.如果您执行which psql,则可能会看到usr/bin/psql而不是usr/local/bin/psql,这是HomeBrew的正确选择.如果运行brew doctor,您应该会收到一条消息,指出您需要将usr/local/bin添加到PATH env变量的开头.

It's a PATH issue. Mac OSX Lion includes Postgresql in the system now. If you do a which psql you'll likely see usr/bin/psql instead of usr/local/bin/psql which is HomeBrew's correct one. If you run brew doctor you should get a message stating that you need to add usr/local/bin to the head of your PATH env variable.

编辑.bash_profile或.profile或您正在使用的任何shell并添加: export PATH=/usr/local/bin:$PATH

Editing your .bash_profile or .profile, or whichever shell you're using and adding: export PATH=/usr/local/bin:$PATH

作为PATH的第一个导出,然后退出您的shell会话或使用source ~/.bash_profile来获取文件,现在应该可以了.

as the first export for the PATH then either quit you shell session or source your file with source ~/.bash_profile and it should now be OK again.

这篇关于升级到OSX 10.7 Lion后修复Postgresql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆