问题1 :
Job for postgresql.service failed because the control process exited with error code. See "systemctl status postgresql.service" and "journalctl -xe" for details.
原因:安装postgresql后需要初始化数据库
解决方案:postgresql-setup initdb
问题2:
Data directory is not empty!
原因:Data目录非空
解决方案:
cd /var/lib/pgsql
rm -f data
service postgresql-11 initdb OK。
sysetmctl restart postgresql-11
问题3:无法远程连接:
原因:安装完成后默认是只能本地访问
解决方案:
vim /var/lib/pgsql/11/data/pg_hba.conf
增加
vim /var/lib/pgsql/11/data/postgresql.conf
然后重启服务
sysetmctl restart postgresql-11