postgresql rake db:setup 导致 fe_sendauth 没有提供密码

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25159660/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 01:34:20  来源:igfitidea点击:

rake db:setup results in fe_sendauth no password supplied

ruby-on-railsrubypostgresqlubuntupg

提问by szatan

When I run: rake db:setup

当我运行时: rake db:setup

i get:

我得到:

fe_sendauth: no password supplied

Couldn't create database for {"adapter"=>"postfresql", "encoding"=>"unicode",
"host"=>"localhost", "pool"=>5, "username"=>"my_user", "password"=>nil,  
"database"=>"my_db_test"}

-- enable_extension("plpgqsl")
rake aborted


Tasks: TOP => db:schema:load

My database.yml:

我的数据库.yml:

connection: &connection
adapter: postgresql
encoding: unicode
host:     localhost
pool: 5
username: my_user
password:

development:
  <<: *connection
  database: my_db_development

test: &test
  <<: *connection
  database: my_db_test

Already change my pg_hba.conf like in this question: Trying to set up postgres for ror app, getting error - fe_sendauth: no password suppliedBut it not help at all.

已经像在这个问题中一样更改我的 pg_hba.conf:尝试为 ror 应用程序设置 postgres,出现错误 - fe_sendauth:没有提供密码但它根本没有帮助。

回答by KJ_kaka

It's a database connectivity issue.

这是一个数据库连接问题。

Try to connect directly with the database that ur using. If it is asking password then you should use same password in database.yml file.

尝试直接与您使用的数据库连接。如果它询问密码,那么您应该在 database.yml 文件中使用相同的密码。

Check this link http://guides.rubyonrails.org/configuring.html#configuring-a-postgresql-databaseand Ruby on Rails: How can i edit database.yml for postgresql?

检查此链接 http://guides.rubyonrails.org/configuring.html#configuring-a-postgresql-databaseRuby on Rails:如何为 postgresql 编辑 database.yml?

Hoping this links help you

希望这个链接对你有帮助

回答by Eduard Avenda?o

My friend, I was have the same problem. My solution was added the credentials for each environment and enable the host in th value localhost..

我的朋友,我也遇到了同样的问题。我的解决方案为每个环境添加了凭据,并在值 localhost 中启用主机..

like this:

像这样:

development:
<<: *default
database: SM_development
username: user
password: xxxx

host: localhost

test:
<<: *default
database: SM_test
username: user
password: xxxxxx

production:
<<: *default
database: SM_production
username: user
password: xxxxxx

回答by ussferox

try specifying which rails environment you want to do this for, like:

尝试指定您要为其执行此操作的 rails 环境,例如:

RAILS_ENV=test rake db:setup

回答by RAJ

no password suppliedmeans you have not supplied password to posgresqlserver from your database.yml.

no password supplied意味着您没有posgresql从 database.yml向服务器提供密码。

Try to connect to posgresql server form pgadmin or terminal. Add same password (that you have used to login through terminal/pgadmin) to your database.yml.

尝试从 pgadmin 或终端连接到 posgresql 服务器。将相同的密码(您用于通过终端/pgadmin 登录)添加到您的 database.yml。

Now try:

现在尝试:

RAILS_ENV=TEST bundle exec rake db:setup

RAILS_ENV=TEST bundle exec rake db:setup

回答by Som Poddar

if you don't want to specify authentication, try removing username: password:from the .yml file.

如果您不想指定身份验证,请尝试username: password:从 .yml 文件中删除。

回答by Luca B.

Try supplying "empty" password using quotes:

尝试使用引号提供“空”密码:

password: ""

回答by infused

no password suppliedmeans that a password is required but you specified no password. Add the correct password to your database.yml file.

no password supplied表示需要密码但您未指定密码。将正确的密码添加到您的 database.yml 文件中。