Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/57.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 没有pg_hba.conf条目后Rake中止_Ruby On Rails_Postgresql_Rake - Fatal编程技术网

Ruby on rails 没有pg_hba.conf条目后Rake中止

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

尝试在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

欢迎任何线索

我已经创建了
我的用户
,如下所示:

使用CREATEDB超级用户登录创建角色my_用户

并允许我的用户在
pg_hba.conf

my
config/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