Ruby on rails 没有pg_hba.conf条目后Rake中止
尝试在CentOS 6.5上运行我的Rails 4.0.4(Ruby 2.1.1)应用程序 尝试迁移时失败:Ruby on rails 没有pg_hba.conf条目后Rake中止,ruby-on-rails,postgresql,rake,Ruby On Rails,Postgresql,Rake,尝试在CentOS 6.5上运行我的Rails 4.0.4(Ruby 2.1.1)应用程序 尝试迁移时失败: $ rake db:migrate rake aborted! PG::ConnectionBad: FATAL: no pg_hba.conf entry for host "::1", user "my_user", database "my_database_dev", SSL off 我不知道如何解决这个问题。在我的mac上,所有设置都工作正常,无需触摸pg_hba.conf
$ rake db:migrate
rake aborted!
PG::ConnectionBad: FATAL: no pg_hba.conf entry for host "::1", user "my_user", database "my_database_dev", SSL off
我不知道如何解决这个问题。在我的mac上,所有设置都工作正常,无需触摸pg_hba.conf
欢迎任何线索
我已经创建了我的用户
,如下所示:
使用CREATEDB超级用户登录创建角色my_用户代码>
并允许我的用户在pg_hba.conf
myconfig/database.yml
包含
由于某种原因,rake
似乎传递了一个坏的主机,因为我假设::1不是服务器的名称(它看起来更像是Postgres配置中排序的IP掩码)。(编辑:::1
是IPv6本地主机,请参见下面的Doon评论。)
不确定为什么相同的代码在Mac上可以正常工作,但我假设在Rails
配置中有一个database.yml
?您可能想尝试在其中指定一个host
属性(如果您的服务器是本地的,它可以指向localhost),看看这是否有帮助
i、 e
如果Postgres不在Postgres安装的标准端口上(默认安装为5432),您还希望为端口包含一个。:1是ipv6中的本地主机。您的PostgreSQL配置没有v6的配置。尝试将服务器设置为本地主机的ipv4地址127.0.0.1 用my database.yml更新了我的问题,主机设置为localhost,我使用的是默认端口。作为线索,我将继续调查::1是ipv6中的本地主机。啊,好的。我还没有机会使用带有Postgres的ipv6。很高兴知道,谢谢。
development:
adapter: postgresql
host: localhost
encoding: unicode
database: my_database_dev
pool: 5
username: my_user
password:
template: template0
host: localhost