I'd like to setup postgresql for my rails app in Cloud9.
Although I followed the top voted answer of this post, the following error appeared when I tried to bundle exec rake db:create
.
fe_sendauth: no password supplied
...
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "username"=>nil, "password"=>nil, "host"=>"0.0.0.0", "database"=>"app_development"}
fe_sendauth: no password supplied
...
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "username"=>nil, "password"=>nil, "host"=>"0.0.0.0", "database"=>"app_test"}
database.yml
default: &default
adapter: postgresql
encoding: unicode
pool: 5
username: <%= ENV['USERNAME'] %>
password: <%= ENV['PASSWORD'] %>
host: <%= ENV['IP'] %>
development:
<<: *default
database: app_development
test:
<<: *default
database: app_test
production:
<<: *default
database: app_production
Gemfile
gem 'pg', '~> 0.18.2'
Although I found similar questions in stackoverflow, they doesn't work for me.
It would be appreciated if you could give me how to avoid this error.
Cloud 9
can't allow us to access to the pg_hba.conf
file as this post mentioned.
EDIT!!!
host: localhost
was added instead of host: <%= ENV['IP'] %> in "database.yml"
sudo vim /etc/postgresql/9.3/main/pg_hba.conf
# "local" is for Unix domain socket connections only
local all xxx peer
instead of
# "local" is for Unix domain socket connections only
local all username peer