Jason’s Ranting & Raving

Those who don’t read have no advantage over those who can’t.

Posts Tagged ‘Postgres’

Programming: Rails with Postgres – Couldn’t create database

Posted by jaystile on August 31, 2010

Hello internet community! I wanted to share something with you that you may encounter. I was setting up a postgres database and trying to use rake db:create to create the sample database from the getting started tutorial.

I kept getting an error like:

Read error message: FATAL: Ident authentication failed for user "blog_development
...
Couldn't create database for {"encoding"=>"unicode", "username"=>"blog_development", "adapter"=>"postgresql", "database"=>"blog_development", "pool"=>5, "password"=>"tmppass"}

The default Ubuntu Postgres installation requires both a system user and a database user with matching user IDs. It turns out I had to change a setting in postgres to allow connections from just database users.

vi /etc/postgresql/8.4/main/pg_hba.conf
Change the line
local all all ident
to
local all all md5

Note: You cannot have two of the same defined combinations. The first once wins, when I had put “local all all ident” followed by “local all all md5” the second didn’t get defined. That caused me a couple of hours of heartache.

Posted in Programming | Tagged: , , | 1 Comment »