空的,不可编辑的pg_hba.conf文件 [英] Empty, uneditable pg_hba.conf file
问题描述
我正在尝试通过本教程将Sinatra应用程序连接到PostgreSQL数据库:
I am trying to connect my Sinatra app to PostgreSQL database with this tutorial: http://samuelstern.wordpress.com/2012/11/28/making-a-simple-database-driven-website-with-sinatra-and-heroku/. Everything goes fine until I try to execute:
rake:db migrate
然后我收到此错误:
rake aborted!
PG::ConnectionBad: fe_sendauth: no password supplied
似乎我应该在pg_hba.conf文件中更改权限,但是,打开它,我什么也看不到.而且,如果我尝试在其中写入内容,它会显示为"只读".
It seems like I should change my permissions in pg_hba.conf file, but, opening it, I see nothing. And, if I try to write something into it, it says it's "readonly".
我是消除错误以及下一步去哪里的正确方法吗?
Am I on the right way of getting rid of the error and where to go next?
编辑:实际上,如果我尝试从另一个文本编辑器中打开它,则表明我没有权限.
edit: actually, if I try to open it from another text editor, it says I have no permission to.
推荐答案
所以 pg_hba.conf 是空的,因为我试图用SublimeText打开它,而sublime并没有告诉我我不是允许读取它,它只是显示了一个空文件.
要编辑 pg_hba.conf ,我需要通过终端
So pg_hba.conf was empty because I was trying to open it with SublimeText and sublime didn't tell me that I was not permitted to read it, it just showed me an empty file.
And to edit pg_hba.conf I needed to open it through terminal
/etc/postgresql/9.3/main$ sudo subl pg_hba.conf
使用sudo.
这篇关于空的,不可编辑的pg_hba.conf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!