简体   繁体   English

Rails / PostgreSQL问题:PG :: ConnectionBad:fe_sendauth:未提供密码

[英]Rails/PostgreSQL problem: PG::ConnectionBad: fe_sendauth: no password supplied

I'm trying to run my tests for my app but I keep getting both this errors: 我正在尝试为我的应用程序运行测试,但我一直遇到以下两个错误:

PG::ConnectionBad: fe_sendauth: no password supplied PG :: ConnectionBad:fe_sendauth:未提供密码

PG::ConnectionBad: FATAL: sorry, too many clients already PG :: ConnectionBad:严重:抱歉,已经有太多客户端

I'be read all previous answers and it seems to be, for everybody else, either a missing password or a misconfiguration of the pg_hba.conf file. 我已经阅读了所有先前的答案,对于其他所有人来说,似乎都是缺少密码或pg_hba.conf文件配置错误。

This is how my database.yml looks like: 这是我的database.yml的样子:

default: &default
  adapter: postgresql
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  timeout: 5000
  encoding: utf8
  reconnect: true
  host: localhost
  username: postgres
  password: <password>

development:
  <<: *default
  database: <dev-db>
  host: <dev-host>
  username: <dev-user>
  password: <dev-pass>

test:
  <<: *default
  database: <test-db>

I already checked the pg_hba.conf config file and its configured to md5 for all entries listed. 我已经检查了pg_hba.conf配置文件,并为列出的所有条目将其配置为md5。

Any clues to what might be the problem? 关于可能是什么问题的任何线索?

I'm running PostgreSQL 10, Rails 5.2.3 on Ruby 2.5.5, on a Macbook with Mojave. 我在装有Mojave的Macbook上运行PostgreSQL 10,Ruby 2.5.5上的Rails 5.2.3。

Thanks in advance. 提前致谢。

Does your postgres user actually have a password set on it? 您的postgres用户实际上设置了密码吗? Typically there is no password for the default postgres user, so this is something you would need to have gone out of your way to do; 通常,默认的postgres用户没有密码,因此您需要完全避免这种情况。 judging by the error message, it sounds like you are using the default posgres user and have not gone out of your way to set a password in the PostgreSQL CLI. 从错误消息来看,听起来您正在使用默认的posgres用户,并且还没有在PostgreSQL CLI中设置密码的方式。

I suggest stripping it down to a very basic default, functional config like: 我建议将其简化为非常基本的默认功能配置,例如:

postgres: &postgres
  adapter: postgresql
  encoding: utf8
  pool: 5
development:
  <<: *postgres
  database: project_name_development
test:
  <<: *postgres
  database: project_name_test

Then incrementally add back additional configuration options one at a time, confirming that each one works before adding the next. 然后,一次增量地添加回其他配置选项,确认每个选项都可以正常工作,然后再添加下一个。 Env vars also may not be available to database.yml depending on your project configuration and installed gems. Env vars也可能不适用于database.yml,具体取决于您的项目配置和已安装的gem。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PG :: ConnectionBad fe_sendauth:未提供密码 - PG::ConnectionBad fe_sendauth: no password supplied PG::ConnectionBad: fe_sendauth: 未提供密码 - PG::ConnectionBad: fe_sendauth: no password supplied capistrano,rails,PG :: ConnectionBad:fe_sendauth:没有提供密码 - capistrano, rails, PG::ConnectionBad: fe_sendauth: no password supplied Rails 控制台导致 PG::ConnectionBad: fe_sendauth: 没有提供密码 - Rails Console results in PG::ConnectionBad: fe_sendauth: no password supplied 耙终止:PG :: ConnectionBad:fe_sendauth:未提供密码 - rake aborted:PG::ConnectionBad: fe_sendauth: no password supplied 修复方法:PG :: ConnectionBad:fe_sendauth:未提供密码 - how to fix: PG::ConnectionBad: fe_sendauth: no password supplied &#39;initialize&#39;:fe_sendauth:不提供密码(PG :: ConnectionBad) - `initialize': fe_sendauth: no password supplied (PG::ConnectionBad) 耙子流产了! PG :: ConnectionBad:fe_sendauth:没有提供密码 - rake aborted! PG::ConnectionBad: fe_sendauth: no password supplied fe_sendauth:未提供密码 (PG::ConnectionBad) Docker 容器 - fe_sendauth: no password supplied (PG::ConnectionBad) Docker container PostgreSQL数据库迁移错误:PG :: ConnectionBad:fe_sendauth:未提供密码 - postgresql database migration error: PG::ConnectionBad: fe_sendauth: no password supplied
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM