95

データベース.yml:

# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
development:
  adapter: postgresql
  encoding: utf8
  database: sampleapp_dev  #can be anything unique
  #host: localhost
  #username: 7stud
  #password: 

  #adapter: sqlite3
  #database: db/development.sqlite3
  pool: 5
  timeout: 5000

# 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
  encoding: utf8
  database: sampleapp_test  #can be anything unique
  #host: localhost
  #username: 7stud
  #password: 
  #adapter: sqlite3
  #database: db/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: postgresql
  database: sampleapp_prod   #can be anything unique
  #host: localhost
  #username: 7stud
  #password: 
  #adapter: sqlite3
  #database: db/production.sqlite3
  pool: 5
  timeout: 5000

pg_hba.conf:

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     postgres                                md5
#host    replication     postgres        127.0.0.1/32            md5
#host    replication     postgres        ::1/128                 md5

最初の 3 行の METHOD を md5 から trust に変更しましたが、それでもエラーが発生します。

そして、database.yml でどのような組み合わせを試しても、次のようになります。

~/rails_projects/sample_app4_0$ bundle exec rake db:create:all

私はいつもエラーが発生します:

fe_sendauth: パスワードが指定されていません

このチュートリアルに従って、セットアップを行いました。

https://pragtob.wordpress.com/2012/09/12/setting-up-postgresql-for-ruby-on-rails-on-linux

Mac OSX 10.6.8
PostgreSQL 9.2.4 installed via enterpriseDB installer
Install dir: /Library/PostgreSQL/9.2
4

6 に答える 6

77

pg_hba.confまたはファイルに変更を加えた後postgresql.conf、クラスターをリロードして変更を取得する必要があります。

コマンドラインから:pg_ctl reload

データベース内から (スーパーユーザーとして):select pg_reload_conf();

PGAdmin から: データベース名を右クリックし、[構成の再読み込み] を選択します。

注: 再読み込みは、アーカイブの有効化、変更shared_buffersなどの変更には十分ではありません。これらにはクラスターの再起動が必要です。

于 2013-08-01T14:56:58.037 に答える