Rails + Postgres fe_sendauth:未提供密码 [英] Rails + Postgres fe_sendauth: no password supplied

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

问题描述

我正在尝试将postgresql连接到我的rails项目。我正在学习测试,但是由于有关错误密码的postgresql错误,我的测试无法运行:

Hi I'm trying to hook up postgresql to my rails project. I'm learning testing but my tests aren't running because of a postgresql error about having an incorrect password:

Edmunds-MacBook-Pro:langexchange edmundmai$ rake test:units
rake aborted!
fe_sendauth: no password supplied

我已经阅读了我的pg_hba.conf文件原来已经是这样的:

I've already read around and my pg_hba.conf file was originally already like this:

# 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     edmundmai  

这是我的rails项目中的database.yml文件

here's my database.yml file in my rails project

default: &default
  adapter: postgresql
  encoding: utf8
  pool: 5
  username: edmundmai
  password: 

development:
  <<: *default
  database: project_development

test:
  <<: *default
  database: project_test

production:
  <<: *default
  database: project_production

有人知道我可以解决这个问题吗?如果方便的话,我们可以聊天。

Does anyone know how I could fix this? We can chat if it's easier.

推荐答案

首先,您应该更改:

local   all             all                                     trust

至:

local   all             all                                     md5

然后,您应该在PostgreSQL中使用用户名密码创建 super_user ,之后,将新用户的用户名密码添加到您的 database.yml 文件。

Then, You should create a super_user in PostgreSQL with username and password,after that adding username and password of new user to your database.yml file.

要创建新的 super_user ,请打开 Pg Admin III 并右键单击底部的 Login Roles 创建新的超级用户。

To create new super_user, open Pg Admin III and right click at the bottom Login Roles to create new super user.

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

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