This will really help if you provided your database.yml file
The default connection method is a unix domain socket, which should not be confused with a TCP / IP socket. By default, the unix domain socket connection method is used.
You must verify that the unix user you are trying to run the rails has sufficient permissions to access the domain juice (usually in /var/run/postgresql/.s.PGSQL.5432 )
Try entering the following as the user of the rails:
psql
If you get a database connection error, then this is most likely a permission problem if postgres is actually running.
You can check your /etc/postgresql.conf file and configure the postgres group and socket permissions at startup:
unix_socket_directory = '/var/run/postgresql' # dont worry if yours is different #unix_socket_group = '' # default is usually ok #unix_socket_permissions = 0777 # uncomment this if needed
Another option is to add the user to the group that has write access to the socket, and also allow all users on the computer to access the permission settings 0777 above. You can create a postres_users group for this purpose if, by default, Ubuntu groups provide insufficient granularity for your needs.
Andrew Hacking
source share