pgsql连接设置
- 登录pgsql
psql -h 10.1.146.87 -U username -d dbname
报错如下:
psql: could not connect to server:
Connection refused Is the server running on host "my host name" (IP)
and accepting TCP/IP connections on port 5432?
处理方法:
修改修改postgresql.conf和pg_hba.conf文件
cd /opt/pgsql/data
vim postgresql.conf
listen_addresses = '*'
port = 5432
vim pg_hba.conf
host all all 0.0.0.0/0 password
或者
host all all 10.1.146.87/32 trust
【pgsql连接设置】(1)."trust"和"password"为postgresql数据库登陆验证的方式
"trust"表示信任,即不需要输入密码(即使有密码)
"password"表示需要输入密码
(2).host all all 127.0.0.1/31 trust表示本地连接数据库不需要输入密码
(即使有密码,设为trust后就不需要密码)
(3).host all all 0.0.0.0/0 所有主机连接数据库需要输入密码(如果有密码)
(4).当然,这两个综合后表现的结果就是:
对于本机链接表示信任(不需要输入密码)
对于非本机链接需要输入密码
修改防火墙,开放5432端口
- 报错
文章图片
Paste_Image.png
推荐阅读
- 第6.2章(设置属性)
- py连接mysql
- Android|Android BLE蓝牙连接异常处理
- 15、IDEA学习系列之其他设置(生成javadoc、缓存和索引的清理等)
- performSelectorOnMainThread:withObject:waitUntilDone:参数设置为NO或YES的区别
- springboot整合数据库连接池-->druid
- spring|spring boot中设置异步请求默认使用的线程池
- Python3|Python3 MySQL 数据库连接
- Xshell5|Xshell5 远程连接本地虚拟机Ubuntu16
- Python绘制小红花