SQLSTATE [7] FATAL没有用于主机的ph_hba.conf条目

时间:2016-09-26 07:46:08

标签: database postgresql

我尝试在本地安装由其他人创建的网站。 但是,我无法将数据库与实际网站连接起来。在Firefox上,我收到以下错误:

Message: SQLSTATE[08006] [7] FATAL:  no pg_hba.conf entry for host "147.---.---.---", user "myuser", database "mydb" SSL on FATAL: no pg_hba.conf entry for host "147.---.---.---", user "myuser", database "mydb" SSL off

(地址" 147。---。--- .---"是我的个人IP地址。)

我试图在互联网上找到解决方案,经过多次尝试纠正我的问题,我有以下pg_hba.conf文件:

# DO NOT DISABLE!
# If you change this first entry you will need to make sure that the
# database superuser can access the database using some other method.
# Noninteractive access to all databases is required during automatic
# maintenance (custom daily cronjobs, replication, and similar tasks).
#
# Database administrative login by Unix domain socket
host    all     all     127.0.0.1/0     md5
local   all             postgres                                trust

# TYPE  DATABASE        USER            ADDRESS                 METHOD
host    all     all     0.0.0.0/0       md5
# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust

# IPv6 local connections:
host    all             all             ::1/128                 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     postgres                                trust
host    replication     postgres        127.0.0.1/32            trust
host    replication     postgres        ::1/128                 trust

当然,在pg_hba.conf上进行每次更新后,我使用以下命令重新启动了postgresql:

sudo /etc/init.d/postgresql restart

有没有人知道为什么这不起作用?为什么我总是有同样的错误?我究竟做错了什么? 谢谢你的帮助:)

0 个答案:

没有答案