fe_sendauth:没有提供密码

7st*_*tud 63 postgresql ruby-on-rails-4

database.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
Run Code Online (Sandbox Code Playgroud)

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
Run Code Online (Sandbox Code Playgroud)

我将前三行中的METHOD从md5改为trust,但我仍然得到了错误.

无论我在database.yml中尝试什么组合,当我这样做时:

~/rails_projects/sample_app4_0$ bundle exec rake db:create:all
Run Code Online (Sandbox Code Playgroud)

我总是得到错误:

fe_sendauth:没有提供密码

我按照本教程进行设置:

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
Run Code Online (Sandbox Code Playgroud)

bma*_*bma 59

在更改后pg_hba.confpostgresql.conf文件,集群需要重新加载拿起变化.

从命令行: pg_ctl reload

从db(作为超级用户)内: select pg_reload_conf();

从PGAdmin:右键单击数据库名称,选择"重新加载配置"

注意:重新加载不足以进行诸如启用存档,更改shared_buffers等更改- 这些更改需要群集重新启动.

  • 服务器......但我想通了.我写了一篇关于我在这里使用rails进行postgres的所有步骤:http://stackoverflow.com/questions/17971101/how-do-i-start-enterpisedb-postgresql-on-mac-osx -10-6-8/18007600#18007600 (4认同)
  • 它可能是在安装程序完成安装后开始的(我见过的大多数安装程序/软件包都是这样做的) (3认同)
  • 我有一个后续问题:据我所知,我从未启动过任何服务器。我唯一要做的就是用Mac OSX安装程序安装postgress。然后,我花了几个小时试图弄清楚如何使用postgres而不是碰运气。我刚巧在/Library/PostgreSQL/9.2目录中找到pgAdmin3,所以我点击了它。那么服务器是如何启动的呢?我需要阻止它吗? (2认同)

Use*_*ser 7

psql -U postgres --password

Password:<Enter your password>
Run Code Online (Sandbox Code Playgroud)

然后就会出现这个。 postgres=#

这对我有用


par*_*cer 5

我只是将--password标志放入我的命令中,然后在按 Enter 键后,它要求我输入密码,这是我提供的。