From: craig duncan Date: 2004-11-04T10:02:19+09:00 Subject: Re: Problem getting tiny RAILS demo working Eric Hodel wrote: > On Nov 3, 2004, at 11:19 AM, craig duncan wrote: > >> craig duncan wrote: >> >>> Vincent Foley wrote: >>> >>>> Is config/database.yml properly configured? An authorization error >>>> seems related to username and password. Check out >>>> http://www.rubyonrails.org/show/TutorialStepTwo to make sure your >>>> PostgreSQL configuration is okay. >>>> >>> It is. I can't figure out why ident authentication (postgres) >>> doesn't seem to work but when i make the first line in pg_hba.conf >>> "host all all trust" then every local user has access (e.g. psql >>> postgres). database.yml specifies user "postgres". It >>> really shouldn't matter, though. IDENT authentication shouldn't >>> even be being used. I'm running ruby 1.8.2 on debian unstable, >>> postgresql 7.4.6. I saw something somewhere about needing to run >>> an IDENT daemon, but could find no verification for that idea. >>> Anyway, as i said, IDENT authentication shouldn't even be being used. >>> >>> >>> >> The reason why authentication is failing is because this fails: >> >> psql -h localhost postgres >> >> without the "-h localhost" it works fine. I can ping localhost. I >> don't know why that doesn't work but that's what's keeping Rails >> (activerecord) from connecting to postgres. > > > I don't believe postgres accepts connections on the TCP socket by > default, only the UNIX socket. You need to edit the postgres config > files to set this up for yourself. > It hadn't occurred to me that specifying localhost implied using a TCP socket . . . but you're right. So that solves that. A note in any documentation mentioning the role of the database.yml config file might be in order . . . saying that if you _want_ to restrict the database to only accept connections on UNIX sockets, then just leave the "host" field blank.