好好爱自己!

postgres配置只能让某一个ip的主机登陆

https://stackoverflow.com/questions/11753296/configure-postgresql-to-work-for-only-localhost-or-specified-ip-port

I want to configure PostgreSQL to accept connections only from a specified IP. It should not accept requests from any other IP.

---------------------------------------------

The following pg_hba.conf allows local and specified Ip have privilege login, but reject others。

# TYPE  DATABASE        USER            ADDRESS                 METHOD
local   all             all                                     trust
host    testdb          testuser      192.168.1.1/32             md5
host    all             all           0.0.0.0/0                 reject 
posted @ 2019-02-25 09:56  立志做一个好的程序员  阅读(607)  评论(0编辑  收藏  举报

不断学习创作,与自己快乐相处