postgresql Rails 控制台没有密码提供错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32186349/
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
Rails console no password supply error
提问by user3814030
I am running a rails application with postgresql as a database, I have a user on the database with empty password. The application runs successfully but when I am trying to use a model from the console I am getting the following error.
我正在使用 postgresql 作为数据库运行 rails 应用程序,我在数据库上有一个用户,密码为空。该应用程序成功运行,但是当我尝试从控制台使用模型时,出现以下错误。
PG::ConnectionBad: fe_sendauth: no password supplied
回答by K M Rakibul Islam
Short answer, in your database.yml
file, replace:
简短的回答,在您的database.yml
文件中,替换:
host: localhost
with host: ''
host: localhost
和 host: ''
This should do the trick.
这应该可以解决问题。
For long answer and explanation, look at this answer
对于长答案和解释,请看这个答案