修复方法:PG :: ConnectionBad:fe_sendauth:未提供密码

时间:2018-06-25 15:48:36

标签: ruby-on-rails postgresql localhost pgadmin

我在Ruby on Rails文件夹中

$ 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)

datebase.yml     发展:      适配器:PostgreSQL      编码:unicode      数据库:pcms_development      主机:localhost      泳池:5      用户名:postgres      密码:

test:
 adapter: postgresql
 encoding: unicode
 database: pcms_test
 host: localhost
 pool: 5
 username: postgres
 password: 

我刚刚将Postgresql Server,PGAdmin和Stack Tools安装到了新的Mac mini上。在我的MacBook上,我有一个显示所有服务器的postgresql服务器图标。 (这是我的Mac mini上缺少的)

PGAdmin正在运行。

localhost:3000 / welcome / index

1 个答案:

答案 0 :(得分:2)

作为您在application.yml文件中发布的示例,您未指定密码:

test:
 adapter: postgresql
 encoding: unicode
 database: pcms_test
 host: localhost
 pool: 5
 username: postgres
 password: 

您需要为您的postgres用户设置一个密码,然后将该密码放在您的database.yml中,以解决该问题