#创建数据库服务器【CentOS7】
#设置时区
vi /etc/sysconfig/clock
ZONE=Asia/Shanghai
rm /etc/localtime
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
#添加RPM
yum install -y https://yum.postgresql.org/9.6/redhat/rhel-7-x86_64/pgdg-redhat96-9.6-3.noarch.rpm
#安装PostgreSQL
yum install -y postgresql96-server postgresql96-contrib
#初始化数据库
/usr/pgsql-9.6/bin/postgresql96-setup initdb
#设置开机自启动
systemctl enable postgresql-9.6.service
#启动服务
systemctl start postgresql-9.6.service
#修改用户密码
su - postgres
psql -U postgres
ALTER USER postgres WITH PASSWORD 'aisports!@#123'
#退出数据库
\q
vi /var/lib/pgsql/9.6/data/postgresql.conf
#修改#listen_addresses = 'localhost' 为 listen_addresses='*'
listen_addresses='*'
vi /var/lib/pgsql/9.6/data/pg_hba.conf
#添加 IP4
host all all 127.0.0.1/32 trust
host all all 0.0.0.0/0 trust
#重启
exit
reboot
#systemctl restart postgresql-9.6.service
#导入sql
需要修改配置文件表