Uninstalling PostgreSQL
Select an uninstallation mode based on the installation mode. To prevent data loss, back up the database data before uninstalling the database.
- For details about how to back up the database data, see Backing Up the Database.
- If PostgreSQL is installed using the RPM package of the mirror site, select Uninstalling the Database (Against RPM Package Installation).
- If PostgreSQL is installed by compiling the source code, select Uninstalling the Database (Against Source Code Compilation).
Uninstalling the Database (Against RPM Package Installation)
- Stop the database process as the postgres user.
1 2
su - postgres /home/postgresql-11.3-1/bin/pg_ctl -D /data/pgsql -l logfile stop
- Uninstall the database RPM package as user root.
1rpm -e postgresql-11.3-1.el7.aarch64
Uninstalling the Database (Against Source Code Compilation)
If PostgreSQL is installed by compilation, only corresponding files are generated. Therefore, uninstallation is not involved.
- Stop the database process as the postgres user.
1/usr/local/pgsql/bin/pg_ctl -D /data/pgsql -l logfile stop
- Delete the software installation directory of the database as user root.
1rm -rf /usr/local/pgsql/
Parent topic: Installation Guide