2
我正在通過一個基本的rails教程,當我嘗試使用「rails s」運行我的服務器時 我在我的localhost:3000瀏覽器中獲得了ActiveRecord :: ConnectionNotEstablished。確保database.yml文件具有正確的憑據
我在教程中告訴,以確保我的database.yml具有正確的憑據,但不知道 告訴如何做到這一點。我正在使用Postgresql。這是在我的databse.yml:
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: postgresql
database: myrubyblog
username:postgres
password: theoffice
pool: 5
timeout: 5000
host: localhost
# 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: postgresql
database: myrubyblog
username:postgres
password: theoffice
pool: 5
timeout: 5000
host: localhost
production:
adapter: postgresql
database: myrubyblog
username:postgres
password: theoffice
pool: 5
timeout: 5000
host: localhost
謝謝!
只是給我們你的'database.yml'文件不會有太大的幫助。 Habe你安裝了PostgreSQL嗎?你確保你的PostgreSQL服務器正在運行嗎?你可以通過運行'psql -U postgres postgres'直接連接到計算機上的PostgreSQL數據庫嗎? –