Postgresql,更新宝石后的问题 [英] Postgresql, problems after updating gem

查看:129
本文介绍了Postgresql,更新宝石后的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚更新了我的宝石。现在我有问题连接到我的postgresql数据库。我得到错误:

  PGError 

无法连接到服务器:权限被拒绝
服务器是否在本地运行,并在Unix域套接字/var/pgsql_socket/.s.PGSQL.5432上接受
连接?

我尝试卸载gem并重新安装,我也尝试更改路径文件并将'/ usr / local / bin /'在上面。我尝试了一些帖子:

在升级到OSX 10.7 Lion后修复Postgresql

此应用在更新我的宝石之前工作正常,其他应用仍然连接很好,对同一台服务器。我有我的database.yml文件中的相同设置..什么可能是错误的?

解决方案

错误来自PostgreSQL服务器我已经看过很多次了。它会告诉您,您正在尝试通过Unix域套接字(而不是通过TCP / IP!)连接到运行本地并在端口5432 处侦听的服务器。但没有发现可以接受这种连接的服务器。



您没有提及PostgreSQL服务器的驻留位置 - 我假设您实际上是指连接到数据库服务器您的本地机器。



检查您的设置,尤其是您的 pg_hba.conf 文件。你需要一行:

 本地mydb myuser md5 

 本地全部所有同级

或其他连接方法,包括您的用户和数据库。



 主机... 

  hostssl ... 

它们涉及TCP / IP连接,而不是通过UNIX域套接字的本地连接。当您连接到 localhost 时,您实际上通过本地循环使用TCP / IP并应用这些设置。



记得在编辑 pg_hba.conf 后重新加载。我引用链接网站上的手册:


如果您在活动系统上编辑文件,则需要发出
postmaster(使用pg_ctl reload或kill -HUP)重新读取
文件。



I just updated my gems. And now I have problems connecting to my postgresql database. I get the error:

PGError

could not connect to server: Permission denied
    Is the server running locally and accepting
    connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

I tried uninstalling the gem and reinstalling, I also tried to change the paths file and put '/usr/local/bin/' on top. I tried some of the things from post:

Repairing Postgresql after upgrading to OSX 10.7 Lion

This app worked fine before updating my gems, other apps still connect just fine, to the same server. I have the same settings in my database.yml file.. what could be wrong?

解决方案

The error comes from the PostgreSQL server and I have seen it many times. It tells you that you are trying to connect via Unix domain socket (and not via TCP/IP!) to a server that is running locally and listening at port 5432. But no server can be found that would accept connections like that.

You did not mention where the PostgreSQL server resides - I assume you actually mean to connect to a database server on your local machine.

Check your setup, especially your pg_hba.conf file. You need a line like:

local      mydb    myuser     md5

or

local      all      all       peer

or some other connection method that includes your user and database.

These would not help in your case:

host ...

or

hostssl ...

They concern TCP/IP connections, not local connections via UNIX domain socket. When you connect to localhost you actually use TCP/IP via local loop and these settings apply.

Remember to reload after you edit pg_hba.conf. I quote the manual at the linked site:

If you edit the file on an active system, you will need to signal the postmaster (using pg_ctl reload or kill -HUP) to make it re-read the file.

这篇关于Postgresql,更新宝石后的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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