postgresql fe_sendauth:未提供密码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17996957/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
fe_sendauth: no password supplied
提问by 7stud
database.yml:
数据库.yml:
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: postgresql
encoding: utf8
database: sampleapp_dev #can be anything unique
#host: localhost
#username: 7stud
#password:
#adapter: sqlite3
#database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: postgresql
encoding: utf8
database: sampleapp_test #can be anything unique
#host: localhost
#username: 7stud
#password:
#adapter: sqlite3
#database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: postgresql
database: sampleapp_prod #can be anything unique
#host: localhost
#username: 7stud
#password:
#adapter: sqlite3
#database: db/production.sqlite3
pool: 5
timeout: 5000
pg_hba.conf:
pg_hba.conf:
# 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 postgres md5
#host replication postgres 127.0.0.1/32 md5
#host replication postgres ::1/128 md5
I changed the METHOD in the first three lines from md5 to trust, but I still get the error.
我将前三行中的 METHOD 从 md5 更改为 trust,但仍然出现错误。
And no matter what combinations of things I try in database.yml, when I do:
无论我在 database.yml 中尝试什么组合,当我这样做时:
~/rails_projects/sample_app4_0$ bundle exec rake db:create:all
I always get the error:
我总是收到错误:
fe_sendauth: no password supplied
fe_sendauth:未提供密码
I followed this tutorial to get things setup:
我按照本教程进行设置:
https://pragtob.wordpress.com/2012/09/12/setting-up-postgresql-for-ruby-on-rails-on-linux
https://pragtob.wordpress.com/2012/09/12/setting-up-postgresql-for-ruby-on-rails-on-linux
Mac OSX 10.6.8
PostgreSQL 9.2.4 installed via enterpriseDB installer
Install dir: /Library/PostgreSQL/9.2
采纳答案by bma
After making changes to the pg_hba.conf
or postgresql.conf
files, the cluster needs to be reloaded to pick up the changes.
对pg_hba.conf
或postgresql.conf
文件进行更改后,需要重新加载集群以获取更改。
From the command line: pg_ctl reload
从命令行: pg_ctl reload
From within a db (as superuser): select pg_reload_conf();
从数据库中(作为超级用户): select pg_reload_conf();
From PGAdmin: right-click db name, select "Reload Configuration"
从 PGAdmin:右键单击数据库名称,选择“重新加载配置”
Note: the reload is not sufficient for changes like enabling archiving, changing shared_buffers
, etc -- those require a cluster restart.
注意:重新加载对于启用归档、更改shared_buffers
等更改是不够的——那些需要重新启动集群。
回答by parsecer
I just put --password
flag into my command and after hitting Enter it asked me for password, which I supplied.
我只是将--password
标志放入我的命令中,然后在按 Enter 键后,它要求我输入密码,这是我提供的。
回答by Aishwarya kabadi
This occurs if the password for the database is not given.
如果未提供数据库密码,则会发生这种情况。
default="postgres://postgres:[email protected]:5432/DBname"
default="postgres://postgres:[email protected]:5432/DBname"