I am currently trying to deploy my Rails application through Heroku. In order to do so, I needed to switch to postgresql from sqlite3. I did so and tried test running the app by doing "rails s." However, I get the following error on my browser:
could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
It also shows that the error occurred here:
### Convenience alias for PG::Connection.new.
def self::connect( *args )
return PG::Connection.new( *args ) <<< (error in this line)
end
Any help would be appreciated. Thanks!
Depending on how Postgres is installed, sounds like you need to restart Postgres.
Using brew:
brew services restart postgresql
Using asdf:
pg_ctl stop
pg_ctl start
Sometimes you might need to reinstall the pg
gem.