Restarting the terminal is not enough. You can restart Postgres with
service postgresql restart
Question
So I'm trying to start working on an existing RubyRails app, I've got RVM, Rails and PostgreSQL set up. I've tested rails server on a test app I made, I can connect to localhost:3000
just fine. When I copy over the existing app I'm trying to work on, cd
to it and run rails server
, localhost:3000
gives me
PG::ConnectionBad
fe_sendauth: no password supplied
I've looked for a few hours across Google and SO and can't find a proper solution. What I tried after a lot of reading was changing my pg_hba.conf
file for postgres to have the following settings:
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication postgres md5
#host replication postgres 127.0.0.1/32 md5
#host replication postgres ::1/128 md5
I saved these changes and restarted the terminal (to reload these changes), and I am getting the same error on localhost:3000
, the PG:ConnectionBad
error. Could anyone lend a hand? This is so frustrating.
In case it helps, I'm using Ruby 2.1.1
and Rails 4.1.0
and PostgreSQL 9.3
Thank you!
Solution
Restarting the terminal is not enough. You can restart Postgres with
service postgresql restart
OTHER TIPS
Looks like there is no password specified for the database:
fe_sendauth: no password supplied
You can see how you specify username and password for your database here:
http://guides.rubyonrails.org/configuring.html#configuring-a-database