无法设置Rails数据库

时间:2019-04-16 01:13:43

标签: ruby-on-rails postgresql centos7

我正在尝试设置我的Rails环境以在CentOS7上进行开发。尝试创建数据库时出现错误

PG::ConnectionBad: FATAL: no pg_hba.conf entry for host "[local]", user "antarr", database "postgres", SSL off。以下是我的配置

/var/lib/pgsql/10/data/pg_hba.conf

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             postgres                                trust
# IPv4 local connections:
host    all            all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 ident
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     peer
host    replication     all             127.0.0.1/32            ident
host    replication     all             ::1/128                 ident

hostnossl all           all             0.0.0.0/0               trust
host    all             all             0.0.0.0/0               md5

postgresql.conf

listen_addresses = '*'

1 个答案:

答案 0 :(得分:1)

您会看到在本地类型中,您为用户 postgres 拥有特权,将其更改为 all ,以便 antarr 用户可以连接到数据库或数据库中。yml将用户名设置为 postgres

有关更多信息,请参见HERE