CentOS7安装Postgresql

执行命令

Yum install postgresql-server

 

Yum install postgresql-contrib

 

安装完成后,检查postgresql的服务状态

Systemctl status postgresql

 

服务未启动

执行systemctl start postgresql启动服务

执行过程有可能会报错

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

 

再次启动postgresql服务

 

用ps命令查看postgresql进程信息

 

用su – postgres切换到postgresql用户执行psql的操作

 

使用l查看postgresql的所有数据库信息

 

到此可以看到postgresql已正确安装。为了以后每次开机可以启动postgresql,执行如下命令

 

到此postgresql基本的安装和配置完成。

更多文章关注微信公众号“挨踢学霸”

原文地址:https://www.cnblogs.com/itxb/p/8644351.html