如何连接到postgresql数据库

listen_addresses (string)

Specifies the TCP/IP address(es) on which the server is to listen for connections from client applications. The value takes the form of a comma-separated list of host names and/or numeric IP addresses. The special entry * corresponds to all available IP interfaces. The entry 0.0.0.0 allows listening for all IPv4 addresses and :: allows listening for all IPv6 addresses. If the list is empty, the server does not listen on any IP interface at all, in which case only Unix-domain sockets can be used to connect to it. If the list is not empty, the server will start if it can listen on at least one TCP/IP address. A warning will be emitted for any TCP/IP address which cannot be opened. The default value is localhost, which allows only local TCP/IP "loopback" connections to be made.

1.编辑参数文件,然后重启pg

vi $PGDATA/postgresql.conf

bash 复制代码
listen_addresses = '192.168.56.10'

2.编辑pg_hba.conf,然后运行pg_ctl reload

vi $PGDATA/pg_hba.conf

bash 复制代码
host all all 192.168.56.0/24 scram-sha-256
相关推荐
李白客3 小时前
国产数据库"实际用户增长"怎么核验?先定口径,再谈第一
数据库
数据工匠老o4 小时前
一张 5 亿行的表按月分区后,清理历史数据从几小时变成了几秒
数据库·sql
hwscom4 小时前
几分钟开防护,SQL和XSS注入全被护卫神挡住
数据库·sql·xss
石小千4 小时前
Redis开启ACL认证
数据库·redis·缓存
东风微鸣4 小时前
把 Tailscale 接进 Prometheus 监控
java·数据库·prometheus
wno7044 小时前
MYSQL 常用合并函数
android·数据库·mysql
东风微鸣5 小时前
一次断电引发的血案:Ubuntu 26.04 升级中断后的完整救援实录
数据库·ubuntu·postgresql
大侠归来5 小时前
事务能回滚吗?Pipeline 算事务吗?
java·数据库·oracle
临床数据科学和人工智能兴趣组5 小时前
字符串转换为句子风格
大数据·数据库·人工智能·r语言·r语言-4.2.1
夕除5 小时前
PostgreSQL基础
数据库·oracle