我是按照 这个操作部署的 [使用 Puma 和 Nginx 部署 Rails 应用程序]https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-puma-and-nginx-on-ubuntu-14-04)
使用了 rbenv-vars 设置环境变量; 操作 这一步出错了:
RAILS_ENV=production rake db:create
报错信息是:
FATAL: password authentication failed for user "APPNAME_DATABASE_USER=haley"
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"utf8", "pool"=>5, "username"=>"APPNAME_DATABASE_USER=haley", "password"=>"APPNAME_DATABASE_PASSWORD=foobar", "database"=>"appname_production"}
rake aborted!
PG::ConnectionBad: FATAL: password authentication failed for user "APPNAME_DATABASE_USER=haley"
Tasks: TOP => db:create
(See full trace by running task with --trace)
这是 postgres 数据库的配置文件: [/var/lib/pgsql/9.5/data/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
host all all 65.49.212.216/32 trust
# IPv6 local connections:
host all all ::1/128 ident
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication postgres peer
#host replication postgres 127.0.0.1/32 ident
#host replication postgres ::1/128 ident
新建的 haley 用户 登录也提示错误
这么登录会报错 su - haley
[baby@host appname]$ su - haley
Password:
su: Authentication failure
这么登录不需要输入 [数据库用户:haley] 的密码,需要输入 baby 用户的密码 [baby 是我的 centos 系统中的普通用户,不是数据库用户]
[baby@host appname]$ sudo su - haley
[sudo] password for baby:
Last login: Tue Jan 9 04:18:05 EST 2018 on pts/3
Last failed login: Tue Jan 9 04:50:30 EST 2018 on pts/0
There was 1 failed login attempt since the last successful login.
[haley@host ~]$
求解 是哪里出了问题?