Creating postgres database: fe_sendauth: no password supplied

ruby
postgresql

#1

Hi
workspace ruby on rails, ruby 2.3.0

database.yml

default: &default
      adapter: postgresql
      encoding: unicode
      pool: 5
      username:  <%= ENV['USERNAME'] %>
      password:  <%= ENV['PASSWORD'] %>
      host:     <%= ENV['IP'] %>

development:
  adapter: postgresql
  database: c9_development
  host:  <%=ENV['IP']%>
test:
  adapter: postgresql
  database: c9_test
  host:  <%=ENV['IP']%>

I run command rake db:create

fe_sendauth: no password supplied
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5.2/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `initialize'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5.2/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `new'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5.2/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `connect'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5.2/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5.2/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5.2/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout'
/usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection'
/usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:571:in `retrieve_connection'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5.2/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5.2/lib/active_record/connection_handling.rb:87:in `connection'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5.2/lib/active_record/tasks/postgresql_database_tasks.rb:6:in `connection'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5.2/lib/active_record/tasks/postgresql_database_tasks.rb:15:in `create'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5.2/lib/active_record/tasks/database_tasks.rb:93:in `create'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5.2/lib/active_record/tasks/database_tasks.rb:107:in `block in create_current'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5.2/lib/active_record/tasks/database_tasks.rb:275:in `block in each_current_configuration'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5.2/lib/active_record/tasks/database_tasks.rb:274:in `each'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5.2/lib/active_record/tasks/database_tasks.rb:274:in `each_current_configuration'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5.2/lib/active_record/tasks/database_tasks.rb:106:in `create_current'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5.2/lib/active_record/railties/databases.rake:17:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-10.5.0/lib/rake/application.rb:150:in `invoke_task'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `each'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `block in top_level'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-10.5.0/lib/rake/application.rb:115:in `run_with_threads'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-10.5.0/lib/rake/application.rb:100:in `top_level'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-10.5.0/lib/rake/application.rb:78:in `block in run'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-10.5.0/lib/rake/application.rb:75:in `run'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-10.5.0/bin/rake:33:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.0/bin/rake:23:in `load'
/usr/local/rvm/gems/ruby-2.3.0/bin/rake:23:in `<main>'
/usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
Couldn't create database for {"adapter"=>"postgresql", "database"=>"c9_development", "host"=>"0.0.0.0"}

I am watching the various solutions on the Internet for ubuntu, but none has come. I think this error with cloud9 user. How solve this error? Thank you


#2

You need to create a super user in Postgres and the proper environment variables in your workspace so that Rails can use it:

Take a look at this guide, it should set you up correctly:


#4

no. i repeat every step, but again same error:

user:~/workspace/myproject (staging) $ rake db:create
fe_sendauth: no password supplied
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `initialize'
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `new'
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `connect'
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize'
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new'
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection'
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection'
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection'
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection'
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout'
/usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout'
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection'
/usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection'
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:571:in `retrieve_connection'
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-4.2.6/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-4.2.6/lib/active_record/connection_handling.rb:87:in `connection'
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-4.2.6/lib/active_record/tasks/postgresql_database_tasks.rb:6:in `connection'
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-4.2.6/lib/active_record/tasks/postgresql_database_tasks.rb:15:in `create'
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:93:in `create'
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:107:in `block in create_current'
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:275:in `block in each_current_configuration'
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:274:in `each'
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:274:in `each_current_configuration'
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:106:in `create_current'
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-4.2.6/lib/active_record/railties/databases.rake:17:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.2.2/lib/rake/task.rb:248:in `block in execute'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.2.2/lib/rake/task.rb:243:in `each'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.2.2/lib/rake/task.rb:243:in `execute'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.2.2/lib/rake/task.rb:187:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.2.2/lib/rake/task.rb:180:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.2.2/lib/rake/task.rb:173:in `invoke'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.2.2/lib/rake/application.rb:152:in `invoke_task'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.2.2/lib/rake/application.rb:108:in `block (2 levels) in top_level'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.2.2/lib/rake/application.rb:108:in `each'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.2.2/lib/rake/application.rb:108:in `block in top_level'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.2.2/lib/rake/application.rb:117:in `run_with_threads'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.2.2/lib/rake/application.rb:102:in `top_level'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.2.2/lib/rake/application.rb:80:in `block in run'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.2.2/lib/rake/application.rb:178:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.2.2/lib/rake/application.rb:77:in `run'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.1/bin/rake:23:in `load'
/usr/local/rvm/gems/ruby-2.3.1/bin/rake:23:in `<main>'
/usr/local/rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `<main>'
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "username"=>nil, "password"=>nil, "host"=>"0.0.0.0", "database"=>"app_development"}

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

#5

If you have already added the environment variables, try restarting your workspace to make the changes take place.


#6

yes, after restart all fine. thank you


#7

Please mark the post as the problem’s solution!