postgresql 耙子中止!PG::ConnectionBad: fe_sendauth: 没有提供密码 任务: TOP => db:migrate (通过使用 --trace 运行任务查看完整跟踪)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22704025/
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
rake aborted! PG::ConnectionBad: fe_sendauth: no password supplied Tasks: TOP => db:migrate (See full trace by running task with --trace)
提问by user3408293
I get the following when trying a rake db:migrate
尝试时我得到以下信息 rake db:migrate
rake aborted!
PG::ConnectionBad: fe_sendauth: no password supplied
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
I also get a similar message when going to my localhost
转到我的本地主机时,我也收到类似的消息
fe_sendauth: no password supplied
My rails server and rails console won't work either
我的 rails 服务器和 rails 控制台也无法工作
I've been trying a few things and this is what my gemfile currently looks like:
我一直在尝试一些事情,这就是我的 gemfile 目前的样子:
source 'https://rubygems.org'
ruby '2.0.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
gem 'devise'
gem 'pg'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
group :production do
gem 'rails_12factor'
end
and my database.yml
和我的 database.yml
development:
adapter: postgresql
encoding: unicode
database: myapp_development
pool: 5
username: myapp
password:
test:
adapter: postgresql
encoding: unicode
database: myapp_test
pool: 5
username: myapp
password:
production:
adapter: postgresql
encoding: unicode
database: myapp_production
pool: 5
username: myapp
password:
What is the problem? It seems that to access my postgres table locally I need some sort of password? My app works fine when it is run through Heroku. So I am just doing Heroku open and I can submit new links and posts as my app is intended but it won't work locally.
问题是什么?似乎要在本地访问我的 postgres 表,我需要某种密码?我的应用程序在通过 Heroku 运行时运行良好。所以我只是打开 Heroku,我可以按照我的应用程序的意图提交新的链接和帖子,但它不能在本地工作。
回答by andreofthecape
For your local machine, under the test
and development
sections in database.yml
you should change username
to your logged in username. The rails generator makes it the same as the app name - this will not work. For production it does not matter as it is run on Heroku and they change that setting automatically when you deploy.
对于您的本地计算机,在您的test
和development
部分下database.yml
应更改username
为您登录的用户名。rails 生成器使它与应用程序名称相同 - 这将不起作用。对于生产来说,这无关紧要,因为它是在 Heroku 上运行的,并且它们会在您部署时自动更改该设置。
回答by Weapon X
You should have values for usernameand passwordaccording to any of the existing ones. You can check your users with psql -d postgres
and then \du
您应该根据现有的任何值设置用户名和密码值。您可以使用psql -d postgres
然后检查您的用户\du