rubypostgresqlsinatrasinatra-activerecord

rake aborted! PG::ConnectionBad: fe_sendauth: no password supplied sinatra


I can't seem to get this to work. I try to run bundle exec rake db:migrate after running bundle exec rake db:create and it gives me this error:

rake aborted! PG::ConnectionBad: fe_sendauth: no password supplied /home/david/DBC/survey-gorilla-challenge/Rakefile:106:in block (2 levels) in <top (required)>' Tasks: TOP => db:migrate (See full trace by running task with --trace)

I've tried looking around, but it all seems like a solution for rails, whereas I'm using this with Sinatra and activerecord. I'm not sure if that makes any difference. I even tried changing my pg_hba.conf, which looks like this currently:

IPv4 local connections: host all all 127.0.0.1/32 md5 IPv6 local connections: host all all ::1/128 md5

I'm not sure how to get this working. Any help is appreciated.


Solution

  • I solved it. I changed my pg_hba.conf to

    TYPE  DATABASE        USER            ADDRESS                 METHOD
    
    "local" is for Unix domain socket connections only
    
    host   all             all          127.0.0.1/32               trust
     IPv4 local connections:
    host   all             PC           127.0.0.1/32               trust
     IPv6 local connections:
    host   all             all            ::1/128                  trust
    

    and then restarted postgres with sudo nano /etc/postgresql/9.3/main/pg_hba.conf. This gets the migration going.