轨道上的红宝石无法连接到postgres得到PG ::错误:fe_sendauth:没有密码供应

时间:2014-08-08 06:34:43

标签: ruby-on-rails ruby postgresql canvas

我正在尝试按照本指南在我的mac上运行本地画布实例(os 10.9.4): https://github.com/instructure/canvas-lms/wiki/Quick-Start

在我启动画布服务器之前,我需要填充数据库,然后运行:

bundle exec rake db:initial_setup 

但后来我收到了这个错误:

rake aborted!
PG::Error: fe_sendauth: no password supplied
/Users/calvinmwhu/gems/bundler/gems/rails-e86daf8ff727/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:941:in `initialize'
/Users/calvinmwhu/gems/bundler/gems/rails-e86daf8ff727/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:941:in `new'
/Users/calvinmwhu/gems/bundler/gems/rails-e86daf8ff727/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:941:in `connect'
/Users/calvinmwhu/gems/bundler/gems/rails-e86daf8ff727/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:217:in `initialize'

我正在运行ruby 1.9.3p547,我的database.yml看起来像:

test:
  adapter: postgresql
  encoding: utf8
  database: canvas_test
  host: localhost
  username: postgres
  timeout: 5000

test-in-memory:
 adapter: sqlite3
 encoding: utf8
 database: ':memory:'
 pool: 1

development:
  adapter: postgresql
  encoding: utf8
  database: canvas_development
  timeout: 5000
queue:
   adapter: postgresql
   encoding: utf8
   database: canvas_queue_development
   timeout: 5000

production:
  adapter: postgresql
  encoding: utf8
  database: canvas_production
  host: localhost
  username: postgres
  password: 
  timeout: 5000
queue:
  adapter: postgresql
  encoding: utf8
  database: canvas_queue_production
  host: localhost
  username: postgres
  password: 
  timeout: 5000

我的pg_hba.conf是:

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     md5
# 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           trust 
#host    replication     postgres        ::1/128                 md5

最后这里是我在postgres中创建的所有数据库的列表:

           Name           |  Owner   | Encoding | Collate | Ctype |   Access privileges   
--------------------------+----------+----------+---------+-------+-----------------------
 canvas_development       | postgres | UTF8     | C       | C     | 
 canvas_queue_development | postgres | UTF8     | C       | C     | 
 postgres                 | postgres | UTF8     | C       | C     | 
 template0                | postgres | UTF8     | C       | C     | =c/postgres          +
                          |          |          |         |       | postgres=CTc/postgres
 template1                | postgres | UTF8     | C       | C     | =c/postgres          +
                          |          |          |         |       | postgres=CTc/postgres
(5 rows)

很抱歉,我知道以前曾经问过一些类似的问题。但我尝试了几乎所有发布的解决方案,但没有一个能够工作对此有何想法?它强迫我提供密码,但是我应该在database.yml中输入密码(我已经这样做但是没有用)?

谢谢!

1 个答案:

答案 0 :(得分:0)

pg_hba和postgres用户遇到了问题。 您正在使用MacOS,因此在您的本地计算机上,在database.yml文件的测试和开发部分下,您应该将用户名更改为您登录的用户名(而不是postgres)。