After updating to Yosemite 10.10 I cannot connect to my postgresql database. I run the rails console and try and get the first user but get this error...
> ➜ game_golf git:(master) ✗ rails c
> Loading development environment (Rails 4.1.4)
> [1] pry(main)> User.first
> PG::ConnectionBad: could not connect to server: Connection refused
> Is the server running on host "localhost" (::1) and accepting
> TCP/IP connections on port 5432?
> 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?
> from /Users/pauldornfeld/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:888:in `initialize'
> [2] pry(main)>
What do I do! I have tried to reinstall postgresql, reinstall homebrew. Please help!
“Could not connect to server: Connection refused” To be sure that PostgreSQL is running, you can also restart it with systemctl restart postgresql. If this does not fix the problem, the most likely cause of this error is that PostgreSQL is not configured to allow TCP/IP connections.
I found this.
cd /usr/local/var/postgres mkdir pg_tblspc pg_twophase pg_stat_tmp
It worked for me.
Checking the server.log will show you what directories it's looking for. Adding them to your postgres directory should fix this. (Was going to comment above, but don't have enough reputation)
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