加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

debian 8.1 (jessie) 安装 postgresql

发布时间:2020-12-13 17:16:42 所属栏目:百科 来源:网络整理
导读: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 postgr

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读