[postgres@hgdb01 data]$ vi pg_hba.conf
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all md5
host all postgres 192.168.137.0/24 md5
host all all ::1/128 md5
[postgres@hgdb01 data]$ psql -U postgres -W -h localhost -d testdb -p 1921
Password for user postgres: #此处必须是交互式输入密码
psql (9.5.7)
Type "help" for help.