https://www.postgresql.org/docs/current/libpq-pgpass.html

- cd ~
- vi .pgpass,并加入需要登录的服务器的信息,格式:地址:端口:数据库:用户名:密码
这里为127.0.0.1:5432:db:username:password - 保存退出,添加权限 chmod 0600 ~/.pgpass。可用命令ls -al |grep .pgpass查看配置的权限
- 连接查看:psql -h ip -p 5432 -d WaterloggingManage -U postgres --command "select * from tbl_weather"

1641

被折叠的 条评论
为什么被折叠?



