I deploy Rails 5 with PostgreSQL to free app in Heroku. This is my configuration from database.yml
:
production:
adapter: postgresql
username: root
password:
database: example
When I run heroku run rake db:migrate
, I see this error:
rake aborted! PG::ConnectionBad: 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"?
If I add this line to database.yml
:
host: localhost
and run migration again, I see this error:
rake aborted! PG::ConnectionBad: could not connect to server: Connection refused Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?
How to fix it ?
See Question&Answers more detail:os