heroku db: 当我未指定密码时,由于缺少密码而导致拉取失败
当我执行 heroku db:pull 时,它会在以下位置找到我的本地开发数据库:
postgres://127.0.0.1/myapp_development?encoding=utf8
一旦我确认,它就会失败:
Sequel::DatabaseConnectionError -> PGError: fe_sendauth: no password supplied
我尝试使用指定的本地数据库运行拉取,例如
heroku db:pull postgres://root:@localhost/db_name
,这给出了相同的“未提供密码”错误。
我想我可能需要将 root: 更改为 myname: 因为这是我在设置 postgres 时授予超级用户权限的用户,但 root: 或 myname: 都不起作用
我的database.yml 对于指定的所有数据库来说,用户名: 和密码: 为空。
从命令行作为 myname@ubuntu 我可以输入 psql myapp_development 并正常连接并运行选择。
我在这里缺少什么?
与我的pg_hba.conf设置有关吗?我看了一下里面,它说:
# Database administrative login by UNIX sockets
local all postgres ident
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all ident
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
应该在那里使用“可信”吗?如果是这样,如果我编辑该文件,我需要重新启动 postgres 吗?如果“信任”是必要的,那么当以 myname 用户身份登录时,rails 和 psql 命令行工具如何在没有密码的情况下工作?
谢谢你!
When I execute heroku db:pull it finds my local dev db at:
postgres://127.0.0.1/myapp_development?encoding=utf8
once I confirm though, it fails with:
Sequel::DatabaseConnectionError -> PGError: fe_sendauth: no password supplied
I tried running the pull with the local db specified, e.g.
heroku db:pull postgres://root:@localhost/db_name
which gives the same no password supplied error.
I thought I may need to change root: to myname: because thats the user I granted superuser rights to when I setup postgres but neither root: or myname: works
My database.yml has username: and password: blank for all databases specified.
From the command line as myname@ubuntu I can type psql myapp_development and connect fine and run selects.
What am I missing here?
Is it related to my pg_hba.conf settings? I had a look inside that and it says:
# Database administrative login by UNIX sockets
local all postgres ident
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all ident
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
Should 'trusted' be used there? And if so if I edit that file do I need to restart postgres? And if 'trust' is necessary then how come rails and the psql command line tools work without passwords when logged in as my myname user?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
身份验证方法
trust
可能可以解决问题,但您无疑知道,这并不安全。编辑
pg_hba.conf
后,您无需重新启动。 A重新加载
< /strong> 就足够了(引用手册):请参阅详细手册。您可能需要 8.3 版本的手册。 heroku 上的共享数据库当前在 PostgreSQL 8.3 上运行。 (另外,我怀疑你是否有权访问heroku上的pg_ctl。)
请注意 这个:
强调我的。您也许能够在本地登录,因为 auth-方法
ident
或peer
允许这样做。但为了您的目的,您可能需要密码!Authentication method
trust
might do the trick, but as you are undoubtedly aware, this is not secure.After editing
pg_hba.conf
, you don't have to restart. Areload
is enough (quoting the manual):See the fine manual. You might need the manual for version for 8.3. Shared db on heroku currently runs on PostgreSQL 8.3. (Also, I doubt you have access to pg_ctl on heroku.)
Be aware of this:
Emphasis mine. You might be able to log in locally, because the auth-methods
ident
orpeer
allow for that. But for your purpose you may need a password!