ruby-on-rails - 如何修复:PG::ConnectionBad:fe_sendauth:未提供密码
问题描述
我在我的 Ruby on Rails 文件夹中
$ 导轨服务器
WARNING: Nokogiri was built against LibXML version 2.9.4, but has dynamically loaded 2.8.0
** Invoke db:migrate (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:load_config
** Execute db:migrate
rake aborted!
PG::ConnectionBad: fe_sendauth: no password supplied
/Users/snowflake/.rvm/gems/ruby-2.5.1@global/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/Users/snowflake/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:15:in `eval'
/Users/snowflake/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
数据库.yml
development:
adapter: postgresql
encoding: unicode
database: pcms_development
host: localhost
pool: 5
username: postgres
password:
test:
adapter: postgresql
encoding: unicode
database: pcms_test
host: localhost
pool: 5
username: postgres
password:
我刚刚在我的新 Mac mini 上安装了 Postgresql Server、PGAdmin、Stack Tools。在我的 MacBook 上,我有一个显示所有服务器的 postgresql 服务器图标。(这在我的 Mac mini 上没有)
PGAdmin 正在运行。
本地主机:3000/欢迎/索引
解决方案
作为您在 application.yml 文件中发布的示例,您没有指定密码:
test:
adapter: postgresql
encoding: unicode
database: pcms_test
host: localhost
pool: 5
username: postgres
password:
您需要为您的 postgres 用户设置密码并将该密码放在您的 database.yml 以解决问题
推荐阅读
- javascript - jquery拖动删除一个元素会改变其他放置元素的位置
- angular - 如何对角度动态表中的行进行分组?
- google-colaboratory - 在 mnsit 数据集上应用 torchvision.transforms 后,如何使用 cv2_imshow 进行查看?
- python-3.x - 在python中删除复数
- laravel - 离开文本字段后 Laravel livewire 元素给出错误 419
- mongodb - Mongo DB - UpdateMany 列数据
- python - tensorflow 2.x 可以在最新的 Python 上运行吗?
- pine-script - strategy.entry() 没有在应该开仓的时候开仓
- ansible - 使用 Ansible 的日期时差
- ios - 如何防止 Chrome-in-iOS 上的双击放大