POSTGRESQL 9.1 FATAL: password authentication failed for user "postgres"

本文介绍如何配置PostgreSQL数据库以允许远程访问,并演示了如何修改默认的postgres用户密码。具体步骤包括编辑配置文件以开启监听所有地址、设置密码加密、添加客户端连接规则并重启服务。

1.配置postgreql 可以远程访问:

sudo vim /etc/postgresql/9.1/main/postgresql.conf

root@ubuntuserver:~# sudo vi /etc/postgresql/9.1/main/postgresql.conf
—>改变行:#listen_addresses = ‘localhost’
—>修改为:listen_addresses = ‘*’
—>改变行:#password_encryption = on
—>修改为:password_encryption = on
root@ubuntuserver:~# sudo vi /etc/postgresql/9.1/main/pg_hba.conf
—>文件末添加行:# to allow your client visiting postgresql server
—>文件末添加行:host all all 0.0.0.0 0.0.0.0 md5
root@ubuntuserver:~# sudo /etc/init.d/postgresql-9.1 restart

2.修改默认的postgres 密码 

sudo -u postgres psql template1


ALTER USER postgres with encrypted password 'your_password'

3.重启POSTGRESQL服务

sudo /etc/init.d/postgresql-9.1 restart

转载于:https://www.cnblogs.com/kfx2007/p/3468772.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值