debian 8.1 (jessie) 安装 postgresql

前端之家收集整理的这篇文章主要介绍了debian 8.1 (jessie) 安装 postgresql前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1、 安装

root@dslab:/home/sil4# aptitude search postgresql

root@dslab:~# apt-get install postgresql-9.4

root@dslab:/home/sil4# apt-get install postgresql-client-9.4

2、配置

1)、修改 postgres 用户密码

sil4@dslab:/etc$ sudo passwd -d postgres //删除密码
passwd: password expiry information changed.

sil4@dslab:/etc$ sudo -u postgres passwd //修改密码
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

2)、修改 postgresql 数据库 配置


#vi/etc/postgresql/9.4/main/postgresql.conf

1.监听任何地址访修改连接权限

#listen_addresses=‘localhost’改为listen_addresses=‘*’

//如果想让Postgresql 监听整个网络的话,将 listen_addresses 前的#去掉,

并将 listen_addresses = 'localhost' 改 成 listen_addresses = '*'

2.启用密码验证
#password_encryption=on 改为 password_encryption=on//这里记得要把#去掉
3.可访问的用户ip段
#
vi/etc/postgresql/9.4/main/pg_hba.conf
并在文档末尾加上以下内容

#toallowyourclientvisitingpostgresqlserver
hostallall0.0.0.00.0.0.0md5


4.数据库认证重新配置

$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

[ ok ] Restarting postgresql (via systemctl): postgresql.service. //成功



参考:

http://stackoverflow.com/questions/27211158/no-passwd-entry-for-user-postgres-error

原文链接:https://www.f2er.com/postgresql/195080.html

猜你在找的Postgre SQL相关文章