1、查看服务状态并停止服务
systemctl status postgresql systemctl stop postgresql systemctl disable postgresql
2、使用 YUM 命令卸载 PostgreSQL
yum remove postgresql*
3、验证 RPM 包是否卸载干净
rpm -qa | grep postgresql
4、删除 PostgreSQL 数据文件和配置文件目录(非必要)
rm -rf /var/lib/pgsql
systemctl status postgresql systemctl stop postgresql systemctl disable postgresql
yum remove postgresql*
rpm -qa | grep postgresql
rm -rf /var/lib/pgsql