1.更改pg_hba.conf,配置用户的访问权限
vim pg_hba.conf
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
host all all 192.168.1.0/24 md5
host all all 0.0.0.0/0 md5 # 增加这一行
# IPv6 local connections:
host all all ::1/128 trust
2.更改postgresql.conf
vim postgresql.conf
listen_address = '*' #更改这一行
3.重启
su - postgres
pg_ctl restart
本文详细介绍了如何通过修改pg_hba.conf和postgresql.conf文件来配置PostgreSQL数据库的远程访问权限,包括设置不同的连接方法和重启服务的具体步骤。
2040

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



