Reputation: 44
I have been following Heroku's guide to getting started with Ruby on Heroku, and have gotten stuck trying to connect to the postgres database.
When I run:
bundle exec rake db:create db:migrate
I am left with this error:
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
And:
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "database"=>"garrett", "username"=>"ruby-getting-started"}
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
I have tried editing my database.yml file but I'm not sure if I am changing the correct parameters:
default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: 5
development:
<<: *default
database: ruby-getting-started_development
username: ruby-getting-started
test:
<<: *default
database: ruby-getting-started_test
production:
<<: *default
database: ruby-getting-started_production
username: ruby-getting-started
password: <%= ENV['RUBY-GETTING-STARTED_DATABASE_PASSWORD'] %>
Do I have my database.yml setup incorrectly or am I completely wrong?
Upvotes: 1
Views: 594
Reputation: 1055
This is a common Postgres error that is basically telling you it can’t find the server. This can be caused by various reasons from not having it installed to a broken path from an OS update.
If you do have the server installed you could re install it through Homebrew or the GUI windows installer found at postgres.org.
Either way the fastest fix is to use a single package installer like Postgres.app for mac.
Upvotes: 1