1

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!

5
  • "restarted the terminal (to reload these changes)". That doesn't work. You need to reload the PostgreSQL service (pg_ctl reload or SIGHUP the postmaster), or restart the computer if you don't know how to do that. Commented May 13, 2014 at 22:58
  • Restarting the terminal is not enough. Try service postgresql restart Commented May 13, 2014 at 23:01
  • Hey thanks for the comments, I use the above service postgresql restart to restart properly, thanks for that. Now I have an error that says the database is not created, I'll give it a few tries myself and post back. Thanks for the help so far everyone! Commented May 13, 2014 at 23:44
  • Update: I got the database working, the site loads perfectly now. I can finally start developing. Thank you so much @p11y Make an answer so I can choose it! Commented May 13, 2014 at 23:53
  • @Karysto great news, good luck with your project! Commented May 13, 2014 at 23:55

2 Answers 2

1

Restarting the terminal is not enough. You can restart Postgres with

service postgresql restart
Sign up to request clarification or add additional context in comments.

Comments

0

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

1 Comment

I made a user with no password, so I do not want to enter a password. I'm going to try the above comments and update everyone. Thanks for the help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.