1、设置密码
su - postgres
psql # 登进去(默认没有密码)
#执行sql语句,修改密码,postgres为用户名,其他用户修改也是如此
postgres=# \password postgres
2、更改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
3、更改postgresql.conf
vim postgresql.conf
listen_address = '*' #更改这一行
4、重启
su - postgres
/data/pgsql/bin/pg_ctl -D /data/pgsql/data -l logfile restart
5、navicat连接