https://www.postgresql.org/docs/8.3/static/libpq-pgpass.html
vi ~/.pgpass
输入以下内容
hostname:port:database:username:password
chmod 0600 ~/.pgpass
然后psql指令 psql -U user -h host 可以不用密码