在运行命令rake db:create
时,系统会抛出postgresql authentication fails
FATAL: password authentication failed for user "postgres"
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "username"=>"postgres", "password"=>"password", "timeout"=>5000, "host"=>"localhost", "database"=>"rails-sample-guestbook-master_development"}
rake aborted!
database.yml文件
default: &default
adapter: postgresql
encoding: unicode
pool: 5
username: supranimbus
password: 123456789
timeout: 5000
host: localhost
development:
<<: *default
database: rails-sample-guestbook-master_development
test:
<<: *default
database: rails-sample-guestbook-master_test
production:
<<: *default
database: rails-sample-guestbook-master_production
答案 0 :(得分:0)
我想问题是postgresql
上的设置密码如果您不记得默认密码,请转到 pgAdmin 点击打开信息中心,然后左侧边栏看下面的内容图像
点击属性... ,然后会打开一个模式,如下图所示
并点击定义标签,然后查看密码字段并设置新密码,请记住postgres
用户名的密码。
这是用于密码设置的!
现在更新您的database.yml
文件,如下所示
default: &default
adapter: postgresql
encoding: unicode
username: postgres
password: 123456 #=> which you set for postgres
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
development:
<<: *default
database: project_development
希望能提供帮助