PostgreSQL使用Npgsqls连接pgsql时出错

PostgreSQL使用Npgsqls连接pgsql报错

出现authentication method 10 not supported的解决办法

1. 打开C:\Program Files\PostgreSQL\14\data\pg_hba.conf文件

2. 注释默认文件配置,改成trust

3. 重启POSTGIS服务即可

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# TYPE  DATABASE        USER            ADDRESS                 METHOD

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

# "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