[38722] CONTEXT: line 87 of configuration file "/Program/Pg12/pg_data/pg_hba.conf"[38722] FATAL: could not load pg_hba.conf[38736] LOG: listening on IPv6 address "::1", port 5432[38736] LOG: listening on IPv4 address "127.0.0.1", port 5432
不能从WIN环境复制粘贴,只能从上一行复制,否则有特殊隐藏字符导致报错
# TYPE DATABASE USER ADDRESS METHOD# "local" is for Unix domain socket connections onlylocal all all trust# IPv4 local connections:host all all 127.0.0.1/32 trusthost all all 192.168.2.0/24 trust
补充:1、允许本地登录数据库,数据库地址localhost,用户user1,数据库db1:host db1 user1 127.0.0.1/32 md52、允许192.168.159.0~192.168.159.255网段登录数据库:host all all 192.168.159.0/24 md53、指定信任IP,192.168.159.10登录数据库:host all all 192.168.159.10/32 trust
本地远程模式链接被拒绝了
[shark@sharkdb=>~]$pgsql -h 192.168.2.178 -p 5432 -U shark -W 123456Password:pgsql: error: could not connect to server: could not connect to server: 拒绝连接Is the server running on host "192.168.2.178" and acceptingTCP/IP connections on port 5432?
先修改下配置文件,话说PG的参数文件做得真好,比MYSQL强多了.起码我们知道有哪些参数,参数默认值,可选项,是否要重启.
#------------------------------------------------------------------------------# CONNECTIONS AND AUTHENTICATION#------------------------------------------------------------------------------# - Connection Settings -listen_addresses = '*' # what IP address(es) to listen on;# comma-separated list of addresses;# defaults to 'localhost'; use '*' for all# (change requires restart)port = 5432 # (change requires restart)max_connections = 100 # (change requires restart)
这个监听地址,是指数据库服务器上的网卡地址,还是监听请求链接的地址?
百度AI回答是监听客户端的地址. 这样的话PG_HBA.CONF就有点多余,
各位朋友你知道是哪种吗? 可以留言告诉我下
[shark@sharkdb=>~]$pgsql -h 192.168.2.178 -p 5432 -U shark -W 123456 -d testdbpgsql: warning: extra command-line argument "123456" ignoredPassword:pgsql (12.2)Type "help" for help.SharkSQL> alter user shark password '123456';ALTER ROLETime: 5.661 msSharkSQL>
可以登陆了,WIN到手PGADMIN4也可以登陆了 SHARKDB

只要花点时间,精力去学习下,PG也不难啊! 你看很多运维同事啥都懂,从网络,到JVM,到防火墙,路由器,SSL安全认证,VPN,隧道,
还懂MYSQL,REDIS,ES,MQ,KAFA,K8S,容器,
百度,优快云,AI,群友都是有力的支持!

剩下这些命令和主程序不太好改名字 哎!

![]()
相关阅读:
定制化PGSQL客户端
PG17 外链设置
PG17源码编译安装
PG客户端常用命令
魔改PG客户端 支持部分SHOW命令
再魔改PG12客户端
魔改PG12服务端-修改目录名
1242



被折叠的 条评论
为什么被折叠?



