I am using PostgreSQL 9.1.3 (PostgreSQL 9.1.3 on x86_64-pc-linux-gnu, compiled by gcc-4.6.real (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1, 64-bit) and rails either 3.2.2 or 3.2.1 on ubuntu 11.10.
Now, I can connect with below command with PostgreSQL
-
su postgres
enter password and I can see postgres=#
-
I am placing below details in my config/database.yml and executing “rails db” it is working fine.
development:adapter: postgresql encoding: utf8 reconnect: false database: sample_app_db pool: 5 username: postgres password: passwordhere host: localhost
I am using rvm to access my rails environment. but when I start server using “rails s” command and hit url with “http://localhost:3000”, say – connection not establish.
try this way,
and
open up this file
/etc/postgresql/9.1/main/pg_hba.confchange this line only:
to this:
Don’t forget to restart the postgres server:
Now check, with this command
it should work
This solutions works for
postgresql-9.1, here is the way to install