2015-10-01 288 views
0

我正在研究一個新的RoR應用程序,並且我一直在接收fe_sendauth:創建新數據庫時沒有提供密碼。我已經嘗試安裝並重新安裝postgresql沒有任何改變。fe_sendauth:沒有密碼postgresql提供的錯誤

Eric-Parks-MacBook-Pro:dearMe ericpark$ rake db:create 
fe_sendauth: no password supplied 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `initialize' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `new' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `connect' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:567:in `retrieve_connection' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_handling.rb:113:in `retrieve_connection' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_handling.rb:87:in `connection' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/tasks/postgresql_database_tasks.rb:8:in `connection' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/tasks/postgresql_database_tasks.rb:17:in `create' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:93:in `create' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:107:in `block in create_current' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:275:in `block in each_current_configuration' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:274:in `each' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:274:in `each_current_configuration' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:106:in `create_current' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/railties/databases.rake:17:in `block (2 levels) in <top (required)>' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:240:in `call' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:240:in `block in execute' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:235:in `each' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:235:in `execute' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:179:in `block in invoke_with_call_chain' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:172:in `invoke_with_call_chain' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:165:in `invoke' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:150:in `invoke_task' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:106:in `block (2 levels) in top_level' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:106:in `each' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:106:in `block in top_level' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:115:in `run_with_threads' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:100:in `top_level' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:78:in `block in run' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:75:in `run' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/bin/rake:33:in `<main>' 
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "database"=>"dearMe_development"} 
fe_sendauth: no password supplied 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `initialize' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `new' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `connect' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:567:in `retrieve_connection' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_handling.rb:113:in `retrieve_connection' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_handling.rb:87:in `connection' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/tasks/postgresql_database_tasks.rb:8:in `connection' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/tasks/postgresql_database_tasks.rb:17:in `create' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:93:in `create' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:107:in `block in create_current' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:275:in `block in each_current_configuration' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:274:in `each' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:274:in `each_current_configuration' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:106:in `create_current' 
/Users/ericpark/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/railties/databases.rake:17:in `block (2 levels) in <top (required)>' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:240:in `call' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:240:in `block in execute' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:235:in `each' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:235:in `execute' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:179:in `block in invoke_with_call_chain' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:172:in `invoke_with_call_chain' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:165:in `invoke' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:150:in `invoke_task' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:106:in `block (2 levels) in top_level' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:106:in `each' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:106:in `block in top_level' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:115:in `run_with_threads' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:100:in `top_level' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:78:in `block in run' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:75:in `run' 
/Users/ericpark/.rvm/rubies/ruby-2.2.0/bin/rake:33:in `<main>' 
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "database"=>"dearMe_test"} 
Eric-Parks-MacBook-Pro:dearMe ericpark$ 

的database.yml

# PostgreSQL. Versions 8.2 and up are supported. 
# 
# Install the pg driver: 
# gem install pg 
# On OS X with Homebrew: 
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config 
# On OS X with MacPorts: 
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config 
# On Windows: 
# gem install pg 
#  Choose the win32 build. 
#  Install PostgreSQL and put its /bin directory on your path. 
# 
# Configure Using Gemfile 
# gem 'pg' 
# 
default: &default 
    adapter: postgresql 
    encoding: unicode 
    # For details on connection pooling, see rails configuration guide 
    # http://guides.rubyonrails.org/configuring.html#database-pooling 
    pool: 5 

development: 
    <<: *default 
    database: dearMe_development 

    # The specified database role being used to connect to postgres. 
    # To create additional roles in postgres see `$ createuser --help`. 
    # When left blank, postgres will use the default role. This is 
    # the same name as the operating system user that initialized the database. 
    #username: dearMe 

    # The password associated with the postgres role (username). 
    #password: 

    # Connect on a TCP socket. Omitted by default since the client uses a 
    # domain socket that doesn't need configuration. Windows does not have 
    # domain sockets, so uncomment these lines. 
    #host: localhost 

    # The TCP port the server listens on. Defaults to 5432. 
    # If your server runs on a different port number, change accordingly. 
    #port: 5432 

    # Schema search path. The server defaults to $user,public 
    #schema_search_path: myapp,sharedapp,public 

    # Minimum log levels, in increasing order: 
    # debug5, debug4, debug3, debug2, debug1, 
    # log, notice, warning, error, fatal, and panic 
    # Defaults to warning. 
    #min_messages: notice 

# Warning: The database defined as "test" will be erased and 
# re-generated from your development database when you run "rake". 
# Do not set this db to the same as development or production. 
test: 
    <<: *default 
    database: dearMe_test 

# As with config/secrets.yml, you never want to store sensitive information, 
# like your database password, in your source code. If your source code is 
# ever seen by anyone, they now have access to your database. 
# 
# Instead, provide the password as a unix environment variable when you boot 
# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database 
# for a full rundown on how to provide these environment variables in a 
# production deployment. 
# 
# On Heroku and other platform providers, you may have a full connection URL 
# available as an environment variable. For example: 
# 
# DATABASE_URL="postgres://myuser:[email protected]/somedatabase" 
# 
# You can use this database configuration with: 
# 
# production: 
#  url: <%= ENV['DATABASE_URL'] %> 
# 
production: 
    <<: *default 
    database: dearMe_production 
    username: dearMe 
    password: <%= ENV['DEARME_DATABASE_PASSWORD'] %> 

我相信我能在database.yml中內設置的用戶名和密碼,但我會將它們作爲?

回答

1

MUST添加一個密碼到你的數據庫,你的database.yml應該是這個樣子

# SQLite version 3.x 
# gem install sqlite3 
# 
# Ensure the SQLite 3 gem is defined in your Gemfile 
# gem 'sqlite3' 
development: 
    host: localhost 
    adapter: postgresql 
    database: databasename 
    user: papinotas 
    port: 5432 
    password: databasepassword 

# Warning: The database defined as "test" will be erased and 
# re-generated from your development database when you run "rake". 
# Do not set this db to the same as development or production. 
test: 
    adapter: sqlite3 
    database: db/test.sqlite3 
    pool: 5 
    timeout: 5000 
+0

嗨Waclock,我如何知道數據庫的密碼是什麼?這是否已預設?或者我在database.yml中設置它? –

+0

您必須先使用psql(或任何其他postgres控制檯)創建數據庫時創建它, – Waclock

相關問題