Postgresql, problems after updating gem

▼魔方 西西 提交于 2019-12-11 19:02:49

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/9343452/postgresql-problems-after-updating-gem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!