Jason’s Ranting & Raving

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

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
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.


One Response to “Programming: Rails with Postgres – Couldn’t create database”

  1. Thanks for your tip!

    Was very useful for me.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: