@H_403_1@1、 安装
@H_403_1@root@dslab:/home/sil4# aptitude search postgresql
@H_403_1@root@dslab:~# apt-get install postgresql-9.4
root@dslab:/home/sil4# apt-get install postgresql-client-9.4
@H_403_1@2、配置
@H_403_1@sil4@dslab:/etc$ sudo passwd -d postgres //删除密码
passwd: password expiry information changed.
@H_403_1@sil4@dslab:/etc$ sudo -u postgres passwd //修改密码
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
2)、修改 postgresql 数据库 配置
@H_403_1@
@H_403_1@@H_403_1@#vi/etc/postgresql/9.4/main/postgresql.conf@H_403_1@
#listen_addresses=‘localhost’改为@H_403_1@listen_addresses=‘*’@H_403_1@
@H_403_1@//如果想让Postgresql 监听整个网络的话,将 listen_addresses 前的#去掉,
@H_403_1@并将 listen_addresses = 'localhost' 改 成 listen_addresses = '*'
#password_encryption=on 改为 password_encryption=on//这里记得要把#去掉 @H_403_1@
3.可访问的用户ip段 @H_403_1@
# vi/etc/postgresql/9.4/main/pg_hba.conf @H_403_1@
并在文档末尾加上以下内容
#toallowyourclientvisitingpostgresqlserver @H_403_1@
hostallall0.0.0.00.0.0.0md5
@H_403_1@
@H_403_1@ $sudo vim /etc/postgresql/9.4/main/pg_hba.conf
*4.1
Replace:
# Database administrative login by Unix domain socket
local all postgres peer
To:
# Database administrative login by Unix domain socket
local all postgres trust
4.2
Replace:
# IPv4 local connections:
host all all 127.0.0.1/32 md5
To:
# IPv4 local connections:
host all all 127.0.0.1/32 trust
4.3
Replace:
# "local" is for Unix domain socket connections only
local all all peer(ident)
To:
# "local" is for Unix domain socket connections only
local all all trust
5.Restart DB
-- # /etc/init.d/postgresql restart
@H_403_1@[ ok ] Restarting postgresql (via systemctl): postgresql.service. //成功
@H_403_1@
@H_403_1@参考:
@H_403_1@http://stackoverflow.com/questions/27211158/no-passwd-entry-for-user-postgres-error
原文链接:https://www.f2er.com/postgresql/195080.html