heroku db:当我没有指定密码时,由于缺少密码而导致失败 [英] heroku db:pull failing due to lack of password when I haven't specified a password
问题描述
postgres://127.0.0.1/当我执行heroku db时:找到我的本地开发数据库: myapp_development?encoding = utf8
一旦我确认,它会失败:
Sequel :: DatabaseConnectionError - > PGError:fe_sendauth:没有提供密码
我试着用指定的本地数据库运行pull, p>
heroku db:pull postgres:// root:@ localhost / db_name
这给出了相同的无密码提供的错误。
我想我可能需要更改root:myname :因为那是我设置postgres时授予超级用户权限的用户,但都不是root:或myname:works
我的database.yml具有用户名和密码:全部为空数据库指定。
从命令行myname @ ubuntu我可以键入psql myapp_development并连接正常并运行选择。
我在这里错过了什么?
它与我的pg_hba.conf设置有关吗?我看了一下,它说:
pre $ #通过UNIX套接字进行数据库管理登录
本地所有postgres ident
#TYPE DATABASE USER CIDR-ADDRESS方法
#local仅用于Unix域套接字连接
本地所有全部ident
#IPv4本地连接:
host all all 127.0.0.1/32 md5
#IPv6本地连接:
host all all :: 1/128 md5
应该在那里使用受信任吗?如果是这样,如果我编辑该文件,我是否需要重新启动postgres?如果'trust'是必要的,那么当我的myname用户登录时,rails和psql命令行工具如何在没有密码的情况下工作?
谢谢!
身份验证方法 trust
可能会诀窍,但正如您毫无疑问所知道的,是不安全的。
编辑 pg_hba.conf
后,您不必重新启动。 重新加载
$ b
就足够了(引用手册)在启动时以及主服务器
文件。如果您在活动的
进程收到一个SIGHUP信号时读取pg_hba.conf
系统上编辑文件,您需要向postmaster发送信号(使用pg_ctl
重新加载或
kill
)使它重新读取文件。 > pg_ctl reload
请参阅精细的手册。您可能需要 8.3版本的手册 。 Heroku上的共享数据库目前在PostgreSQL 8.3上运行。 (另外,我怀疑你有权访问heroku上的pg_ctl。)
请注意这个:
如果没有为用户设置密码,则存储的密码为空
,密码身份验证将始终失败。
重点是我的。您可能可以在本地登录,因为 auth-方法 ident
或 peer
允许。但为了您的目的,您可能需要密码!
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!
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. A reload
is enough (quoting the manual):
The
pg_hba.conf
file is read on start-up and when the main server process receives a SIGHUP signal. If you edit the file on an active system, you will need to signal the postmaster (usingpg_ctl
reload orkill -HUP
) to make it re-read the file.
pg_ctl reload
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:
If no password has been set up for a user, the stored password is null and password authentication will always fail for that user.
Emphasis mine. You might be able to log in locally, because the auth-methods ident
or peer
allow for that. But for your purpose you may need a password!
这篇关于heroku db:当我没有指定密码时,由于缺少密码而导致失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!