无法设置 rails 数据库



我正在尝试设置我的 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 = '*'

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

有关更多信息,请参阅此处

最新更新