To remove PostgreSQL from your Ubuntu system, follow these steps:
Note: These steps will completely remove PostgreSQL from your system, including all databases and user accounts. Make sure to back up any important data before proceeding.
Alternatively, you can use the
pg_dropcluster command to remove a specific PostgreSQL cluster from your system. For example, to remove the default cluster (version 11) created during PostgreSQL installation, you can use the following command:
sudo pg_dropcluster 11 main --stop
This will remove the cluster and stop the corresponding PostgreSQL service.