GVKun编程网logo

Strapi CMS,Heroku 错误:主机没有 pg_hba.conf 条目(因为主机上没有相应的设备)

8

在本文中,您将会了解到关于StrapiCMS,Heroku错误:主机没有pg_hba.conf条目的新资讯,同时我们还将为您解释因为主机上没有相应的设备的相关在本文中,我们将带你探索StrapiCMS

在本文中,您将会了解到关于Strapi CMS,Heroku 错误:主机没有 pg_hba.conf 条目的新资讯,同时我们还将为您解释因为主机上没有相应的设备的相关在本文中,我们将带你探索Strapi CMS,Heroku 错误:主机没有 pg_hba.conf 条目的奥秘,分析因为主机上没有相应的设备的特点,并给出一些关于centos – pg_hba.conf主机条目、navicat 连接postgresql报错pg_hba.conf、org.postgresql.util.PSQLException:FATAL:没有用于主机的pg_hba.conf条目、perl – 没有pg_hba.conf条目的主机的实用技巧。

本文目录一览:

Strapi CMS,Heroku 错误:主机没有 pg_hba.conf 条目(因为主机上没有相应的设备)

Strapi CMS,Heroku 错误:主机没有 pg_hba.conf 条目(因为主机上没有相应的设备)

我们在 Heroku 实例上遇到了同样的问题,最近才找到修复方法。

rejectUnauthorized 添加到数据库配置似乎有效。

config/database.js

module.exports = ({ env }) => ({
  defaultConnection: 'default',connections: {
    default: {
      connector: 'bookshelf',settings: {
        client: 'postgres',host: env('DATABASE_HOST','localhost'),port: env.int('DATABASE_PORT',5432),database: env('DATABASE_NAME','strapi'),username: env('DATABASE_USERNAME',password: env('DATABASE_PASSWORD',schema: env('DATABASE_SCHEMA','public'),// Not Required
        ssl: {
          rejectUnauthorized: env.bool('DATABASE_SSL_SELF',false),// For self-signed certificates
        },},options: {
        ssl: env.bool('DATABASE_SSL',});

然而,我不能完全相信,正是 Strapi 论坛上的这篇文章让我找到了答案: https://forum.strapi.io/t/error-no-pg-hba-conf-entry-for-host-ssl-off/3409

接下来是这个链接: https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/configurations.html#database

centos – pg_hba.conf主机条目

centos – pg_hba.conf主机条目

我在我的centos vps中使用postgre收到此错误

Unable to connect to Postgresql server: FATAL: no pg_hba.conf entry
for host “::1”,user “xxx”,database “xxx_xxx”,SSL off in

这是我的pg_hba.conf

local all all md5 
host all all 127.0.0.1/32 md5

一切似乎都是正确的,但总是得到这个错误,无论我创建和设置什么用户.

Unable to connect to Postgresql server: FATAL: no pg_hba.conf entry
for host “::1”,database “xxx_xxx”,SSL off in

“:: 1”表示您通过IPv6进行连接.

指定-h 127.0.0.1或在/ pg_hba.conf中添加/取消注释条目:

host all all ::1/128 md5

navicat 连接postgresql报错pg_hba.conf

PostgreSQ数据库为了安全,它不会监听除本地以外的所有连接请求,当用户通过JDBC访问是,会报一些如下的异常:

org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host

$PGDATA/pg_hba.conf文件配置增加如下:

# TYPE   DATABASE   USER       ADDRESS     METHOD    
 host      all             all                0.0.0.0/0     md5

 其他详细说明,详见博客:https://blog.csdn.net/weixin_30663391/article/details/101325899

org.postgresql.util.PSQLException:FATAL:没有用于主机的pg_hba.conf条目

org.postgresql.util.PSQLException:FATAL:没有用于主机的pg_hba.conf条目

我正在使用 Spring JDBC模板连接到位于远程位置的Postgresql数据库.我正进入(状态

org.postgresql.util.PsqlException: FATAL: no pg_hba.conf entry for host “139.126.243.71”,user “guest”,database “masterdb”,SSL off error

我没有访问远程位置的pg_hba.conf文件.

这是我在我的spring servlet.xml中给出的配置

<bean id="dataSource">
    <property name="driverClassName" value="org.postgresql.Driver"/>
    <property name="url" value="jdbc:postgresql://100.64.35.52":5432/masterdb"/>
    <property name="username" value="root"/>
    <property name="password" value="root"/>
</bean>

我们可以通过给任何属性来解决问题吗?

看来DB服务器不允许SSL关闭连接,您将不得不启用它.从jdbc更改URL:postgresql://100.64.35.52“:5432 / masterdb to jdbc:postgresql://100.64.35.52”:5432 / masterdb?sslmode = require

在http://www.postgresql.org/docs/9.1/static/libpq-ssl.html检查ssl模式的模式详细信息

perl – 没有pg_hba.conf条目的主机

perl – 没有pg_hba.conf条目的主机

我得到以下错误,当我尝试使用DBI连接
DBI connect('database=chaosLRdb;host=192.168.0.1;port=5433','postgres',...) 
Failed: FATAL:  no pg_hba.conf entry for host "192.168.0.1",user "postgres",database "chaosLRdb",SSL off

这里是我的pg_hba.conf文件:

# "local" is for Unix domain socket connections only
local   all         all                               md5
# IPv4 local connections:
host    all         all         127.0.0.1/32          md5
# IPv6 local connections:
host    all         all         ::1/128               md5

host    all         postgres    127.0.0.1/32          trust

host    all        postgres     192.168.0.1/32        trust

host    all        all         192.168.0.1/32        trust

host    all        all         192.168.0.1/128        trust

host    all        all         192.168.0.1/32        md5

host    chaosLRdb    postgres         192.168.0.1/32      md5
local    all        all         192.168.0.1/32        trust

我的perl代码是

#!/usr/bin/perl-w
use DBI;
use FileHandle;

print "Start connecting to the DB...\n";

@ary = DBI->available_drivers(true);
%drivers = DBI->installed_drivers();
my $dbh = DBI->connect("DBI:PgPP:database=chaosLRdb;host=192.168.0.1;port=5433","postgres","chaos123");

我可以知道我在这里想念什么吗?

解决方法

这是一个老问题,但我正在寻找同样的问题的帮助,并注意到问题中指定的pg_hba.conf文件的一些问题。对于后代我以为我会回答。

在pg_hba.conf文件中,我看到一些不正确和混乱的行:

# fine,this allows all dbs,all users,to be trusted from 192.168.0.1/32
# not recommend because of the lax permissions
host    all        all         192.168.0.1/32        trust

# wrong,/128 is an invalid netmask for ipv4,this line should be removed
host    all        all         192.168.0.1/128       trust

# this conflicts with the first line
# it says that that the password should be md5 and not plaintext
# I think the first line should be removed
host    all        all         192.168.0.1/32        md5

# this is fine except is it unnecessary because of the prevIoUs line
# which allows any user and any database to connect with md5 password
host    chaosLRdb  postgres    192.168.0.1/32        md5

# wrong,on local lines,an IP cannot be specified
# remove the 4th column
local   all        all         192.168.0.1/32        trust

我怀疑,如果你md5的密码,这可能工作,如果你修剪线。要获取md5,您可以使用perl或以下shell脚本:

echo -n 'chaos123' | md5sum
 > d6766c33ba6cf0bb249b37151b068f10  -

所以,你的连接线会喜欢:

my $dbh = DBI->connect("DBI:PgPP:database=chaosLRdb;host=192.168.0.1;port=5433","chaosuser","d6766c33ba6cf0bb249b37151b068f10");

有关更多信息,这里是documentation of postgres 8.X’s pg_hba.conf file。

我们今天的关于Strapi CMS,Heroku 错误:主机没有 pg_hba.conf 条目因为主机上没有相应的设备的分享就到这里,谢谢您的阅读,如果想了解更多关于centos – pg_hba.conf主机条目、navicat 连接postgresql报错pg_hba.conf、org.postgresql.util.PSQLException:FATAL:没有用于主机的pg_hba.conf条目、perl – 没有pg_hba.conf条目的主机的相关信息,可以在本站进行搜索。

本文标签: