1. 程式人生 > >配置安裝postgresql 9.6

配置安裝postgresql 9.6

一、下載postgresql的yum源

yum install -y https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm

二、安裝postgresql

yum install -y postgresql96-server postgresql96-contrib

三、初始化資料庫

/usr/pgsql-9.6/bin/postgresql96-setup initdb

四、新增初始密碼

su  postgres 
psql -U postgres 
alter user postgres with password 'new password';

五、讓postgresql支援密碼登陸

vi /var/lib/pgsql/9.6/data/pg_hba.conf
local   all             all                                     md5
host    all             all             127.0.0.1/32            md5
host    all             all             ::1/128                 md5
host    all             all             192.168.0.0/16          md5

六、開啟遠端訪問

listen_addresses='*'