美文网首页
PostgreSQL 配置远程访问

PostgreSQL 配置远程访问

作者: 流浪的三鮮餡 | 来源:发表于2023-09-02 13:59 被阅读0次

postgresql.conf
找到配置文件目录

[root@test pgsql]# locate ostgresql.conf
/usr/pgsql-15/share/postgresql.conf.sample
/var/lib/pgsql/15/data/postgresql.conf

打开文件进行编辑

[root@test pgsql]# vim /var/lib/pgsql/15/data/postgresql.conf
#listen_addresses = 'localhost'         # what IP address(es) to listen on;

改为

listen_addresses = '*'         # what IP address(es) to listen on;

保存退出

pg_hba.conf

[root@test pgsql]# locate pg_hba.conf
/usr/pgsql-15/share/pg_hba.conf.sample
/var/lib/pgsql/15/data/pg_hba.conf

进行修改

[root@test pgsql]# vim /var/lib/pgsql/15/data/pg_hba.conf

找到这一行

host    all             all             127.0.0.1/32            ident

修改为

host    all             all             0.0.0.1/0            md5

保存后重启服务

[root@test pgsql]# systemctl restart postgresql-15

相关文章

网友评论

      本文标题:PostgreSQL 配置远程访问

      本文链接:https://www.haomeiwen.com/subject/xlmxvdtx.html