如何使用PostgreSQL解决Rails中的错误’fe_sendauth:没有提供密码’?

如何使用PostgreSQL解决Rails中的错误’fe_sendauth:没有提供密码’?,第1张

概述我试图用 postgresql数据库创建我的Rails应用程序,但是当我启动rails服务器时,我收到了这个错误: fe_sendauth: no password supplied 这是我一步一步的行动: $sudo apt-get install postgresql postgresql-contrib$gem install pg$rails new timetracker --dat 我试图用 postgresql数据库创建我的Rails应用程序,但是当我启动rails服务器时,我收到了这个错误:

fe_sendauth: no password supplIEd

这是我一步一步的行动:

$sudo apt-get install postgresql postgresql-contrib$gem install pg$rails new timetracker --database=postgresql --skip-unit-test

我的database.yml文件如下所示:

default: &default  adapter: postgresql  enCoding: unicode  pool: 5  host: localhost  username: postgres  password:development:  <<: *default  database: timetracker_developmenttest:  <<: *default  database: timetracker_testproduction:  <<: *default  database: timetracker_production

这是我的pg_hba.conf文件:

# Database administrative login by Unix domain socketlocal   all             postgres                                peer# TYPE  DATABASE        USER            ADDRESS                 METHOD# "local" is for Unix domain socket connections onlylocal   all             all                                     peer# IPv4 local connections:host    all             all             127.0.0.1/32            md5# IPv6 local connections:host    all             all             ::1/128                 md5# modifIEd by me.host    all             all             127.0.0.1/32            trusthost    all             all             127.0.0.1/32            trusthost    all             all             ::1/128                 trust

所以,当我做rails服务器时,我得到了错误,然后这就是我通过这样做得到的:

$rails c$ActiveRecord::Base.connection.instance_variable_get(:@config)

2.1.5 :001 > ActiveRecord::Base.connection.instance_variable_get(:@config)
PG::ConnectionBad: fe_sendauth: no password supplIEd

from
/home/denis/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:655:in initialize' from
/home/denis/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:655:in
new’ from
/home/denis/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:655:in connect' from
/home/denis/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in
initialize’ from
/home/denis/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in
new' from
/home/denis/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in
postgresql_connection’ from
/home/denis/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in
new_connection' from
/home/denis/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in
checkout_new_connection’ from
/home/denis/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in
acquire_connection' from
/home/denis/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in
block in checkout’ from
/home/denis/.rvm/rubIEs/ruby-2.1.5/lib/ruby/2.1.0/monitor.rb:211:in
mon_synchronize' from
/home/denis/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in
checkout’ from
/home/denis/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in
block in connection' from
/home/denis/.rvm/rubIEs/ruby-2.1.5/lib/ruby/2.1.0/monitor.rb:211:in
mon_synchronize’ from
/home/denis/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in
connection' from
/home/denis/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:571:in
retrIEve_connection’ … 4 levels… from
/home/denis/.rvm/gems/ruby-2.1.5/gems/railtIEs-4.2.3/lib/rails/commands/console.rb:9:in
start' from
/home/denis/.rvm/gems/ruby-2.1.5/gems/railtIEs-4.2.3/lib/rails/commands/commands_tasks.rb:68:in
console’ from
/home/denis/.rvm/gems/ruby-2.1.5/gems/railtIEs-4.2.3/lib/rails/commands/commands_tasks.rb:39:in
run_command!' from
/home/denis/.rvm/gems/ruby-2.1.5/gems/railtIEs-4.2.3/lib/rails/commands.rb:17:in
‘ from
/home/denis/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.3/lib/active_support/dependencIEs.rb:274:in require' from
/home/denis/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.3/lib/active_support/dependencIEs.rb:274:in
block in require’ from
/home/denis/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.3/lib/active_support/dependencIEs.rb:240:in load_dependency' from
/home/denis/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.3/lib/active_support/dependencIEs.rb:274:in
require’ from /home/denis/WEB/Rails/timetracker/bin/rails:8:in <top
(required)>' from
/home/denis/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.3/lib/active_support/dependencIEs.rb:268:in
load’ from
/home/denis/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.3/lib/active_support/dependencIEs.rb:268:in block in load' from
/home/denis/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.3/lib/active_support/dependencIEs.rb:240:in
load_dependency’ from
/home/denis/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.3/lib/active_support/dependencIEs.rb:268:in load' from
/home/denis/.rvm/rubIEs/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in
require’ from
/home/denis/.rvm/rubIEs/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in require' from -e:1:in‘2.1.5 :002 >

我第一次使用postgresql,我想我只是做错了.

你能帮帮我吗?

我对此问题的解决方案是从default:group中删除host:localhost. 总结

以上是内存溢出为你收集整理的如何使用PostgreSQL解决Rails中的错误’fe_sendauth:没有提供密码’?全部内容,希望文章能够帮你解决如何使用PostgreSQL解决Rails中的错误’fe_sendauth:没有提供密码’?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/1170360.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-02
下一篇 2022-06-02

发表评论

登录后才能评论

评论列表(0条)

保存