PostgreSQL fe_sendauth:未提供密码 [英] PostgreSQL fe_sendauth: no password supplied

查看:41
本文介绍了PostgreSQL fe_sendauth:未提供密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道 SO 上有数以千计这样的问题,但我都看过了,但我仍然无法解决我的问题.

I know there are thousands of questsions like this one here on SO but i've seen them all and i'm still not able to deal with my problem.

我使用 ansible 做所有事情,所以它非常自动化,但无论如何,这是我的文件:

I'm doing everything using ansible so it's quite automated but, anyway, here are my files:

local   all             all                                     trust
host    all             all             127.0.0.1/32            md5
host    all             all             ::1/128                 md5
host    all             all             10.11.12.0/24           md5

数据库.yml

production:
  database: my_db
  adapter: postgresql
  host: localhost
  username: deploy
  encoding: unicode
  min_messages: WARNING
  template: template0

而且我在我的系统中创建了一个 deploy 用户(和没有设置密码的 postgres 用户).现在,虽然我完全能够使用 psql -d my_db(在服务器上)从 bash 登录到 postgres,但我无法使用我的 rails 应用程序连接到数据库.运行 rake db:migrateMigration 给了我

And i have a deploy user (and postgres user without a password set) in my system created. And now, while i'm totally able to sign in to postgres from bash using psql -d my_db (on server), i'm not able to connect to the db with my rails app. Running rake db:migrateMigration gives me

PG::ConnectionBad: fe_sendauth: no password supplied

我非常不擅长开发开发人员,我从前天早上开始就在与这个问题作斗争,它仍然存在,所以如果有人可以帮助我解决这个问题,我将不胜感激.

I'm quite terrible at beeing a devop and i'm fighting with that issue from the day before yesterday's morning and it's still here so if there is anyone who can help me with that, i would be be more than grateful.

推荐答案

psql 使用本地套接字连接,rails 使用 TCP/IP 上的 localhost.本地是可信的,localhost 需要密码(使用 md5).你可以为你的 rails 用户设置一个 pgpass 文件:http://www.postgresql.org/docs/current/static/libpq-pgpass.html

psql is using a local socket connection, rails is using localhost over TCP/IP. Local is trusted, localhost requires a password (using md5). You could setup a pgpass file for your rails user: http://www.postgresql.org/docs/current/static/libpq-pgpass.html

这篇关于PostgreSQL fe_sendauth:未提供密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆