Search code examples
ruby-on-railsauthenticationrakerails-postgresql

rake db:create fails, authentication problem with postgresql 8.4


first things first, please excuse my utter noobness. I really tried to find a solution out there, but now i'm stuck and completely clueless.

i'm trying to deploy a rails 3 app on a distant server ; when developping on my local VM, no problem showed. But now, when i try to run

rake db:create

it fails, with error (here translated, since i'm french):

FATAL : password authentication failed for user <<mylogin>>

here's my database.yml :

login: &login
  adapter: postgresql
  username: mylogin
  password: mypassword
  host: localhost
  port: 5432
  encoding: UTF8

development:
  <<: *login
  database: somesite_development

test:
  <<: *login
  database: somesite_test

production:
  <<: *login
  database: somesite_production

the user "mylogin" has been created postgre-side with the command-line tool "createuser". It's authorized to create dbs. postgresql.conf configures the server to listen on localhost. I've tried many things with pg_hba.conf, none worked - whatever the method used (ident, password, md5) for user "mylogin" on 127.0.0.1, authentication fails - though i've never had problems connecting / creating dbs with psql.

any clue ?

EDIT: okay, found out how incredibly stupid i've been... the password for my user was simply not set ! I think i forgot the semicolon after

ALTER USER xxxx WITH PASSWORD xxxx ;

... i saw this by requesting "SELECT * FROM pg_shadow;" - the password field was empty. Three days of my life wasted because of this dumb mistake...


Solution

  • okay, found out how incredibly stupid i've been... the password for my user was simply not set ! I think i forgot the semicolon after

    ALTER USER xxxx WITH PASSWORD xxxx ;
    

    ... i saw this by requesting "SELECT * FROM pg_shadow;" - the password field was empty. Three days of my life wasted because of this dumb mistake...