Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
868 views
in Technique[技术] by (71.8m points)

ruby - PostgreSQL Permission denied Error on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432" - Lion Server 10.7.3 or Lion Server 10.7.4

I recently had major permission problems using Lion Server where permissions would change on folders at will. During this time I had started getting the following error when trying to do a rake db:migrate command:

rake aborted!
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"?

This had been working before when I first created a Rails 3.2.3 application while running 10.7.2. All of a sudden I started having this error come up. I read many blogs about this error and tried to remove it but with no success.

I decided to call Apple Enterprise Support to see what I could do. I suspected that Lion Server had gotten corrupted but wanted to confirm with the support team before wiping my server clean and starting over. They confirmed that is what I needed to do in order to straighten it out. I did this on Friday and only installed what I needed to rebuild my Rails app. I still got the error. I tried again some of the other solutions that were posted but still none of them worked. We continued to look for solutions.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

After continuing to search for blog posts we were able to find one that dealt with Lion 10.7.4. What I did not know that something had changed between 10.7.2 when I started writing my Rails application and now with PostgreSQL. We found the following blog post which helped me solve the problem I had for several days.

http://www.mactasia.co.uk/revisited-using-postgresql-in-lion-server

I ended up logging in as root and doing the following:

Made the following changes in /System/Library/LaunchDaemons/org.postgresql.postgres.plist

listen_addresses=127.0.0.1
unix_socket_permissions=0777

Changed the permissions of /var/psql_socket

sudo chmod 755 /private/var/pgsql_socket

Afterwards I logged out of root and logged in as I normally do as a server admin. I no longer got the permission error.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...