Yesterday wasn't this error. I didn't make any changes in my application. Just went to sleep and now I get this.
Error:
home/dartnyan/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.6/lib/
active_record/connection_adapters/
postgresql_adapter.rb:651:in `initialize': could not connect to server:
No such file or directory (PG::ConnectionBad)
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
database.yml
default: &default
adapter: postgresql
pool: 5
imeout: 5000
development:
adapter: postgresql
database: shop_development
pool: 5
username: dartnyan
password: kurt1245
test:
adapter: postgresql
encoding: unicode
database: shop_test
pool: 5
username: dartnyan
password: kurt1245
On your terminal, please run this command
rm /usr/local/var/postgres/postmaster.pid
or if you have a specific version of postgres:
## version 11 for example
rm /usr/local/var/postgresql@11/postmaster.pid
I found that typing the following into terminal helps:
$ cd /usr/local/var/postgres/
$ rm postmaster.pid
I found this over at http://alumni.lewagon.org/questions/60
It also describes what might be happening. The file may get corrupt if Postgresql was not closed 'gracefully'. Example would be if your battery on your laptop were to die.
Looks like the postgres server isn't running. Start the server by running
sudo service postgresql start
I've reinstalled PostgreSQL and now it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With