Monday 15 October 2018

macos - How do I uninstall postgres on Mac OS? Can't kill data


I'd like to uninstall postgres on Mac OS 10.6 and start again with a completely fresh installation and empty databases.


I've killed all running postgres processes and tried to delete the postgres data directory, but no joy (see below): six databases are still there.


I've also tried to find the PGDATA variable, but it seems to be blank. Where are these databases living?


delirium:~ ap257$ kill 7495
delirium:~ ap257$ sudo su - postgres
Password:
delirium:~ postgres$ rm -rf /usr/local/pgsql/

[reinstall postgres from binaries]


delirium:~ ap257$ sudo su - postgres
Password:
delirium:~ postgres$ export PATH=$PATH:/usr/local/pgsql/bin/
delirium:~ postgres$ psql
Password:
psql (8.4.4)
Type "help" for help.
postgres=# \l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
------------------+----------+----------+-----------+-------+-----------------------
osqa | postgres | UTF8 | C | C | =Tc/postgres
: postgres=CTc/postgres
: osqa=CTc/postgres
postgres | postgres | UTF8 | C | C |
production | postgres | UTF8 | C | C | =Tc/postgres
: postgres=CTc/postgres
: anna=CTc/postgres
template0 | postgres | UTF8 | C | C | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | C | C | =c/postgres
: postgres=CTc/postgres
template_postgis | postgres | UTF8 | C | C |
(6 rows)
postgres=# \q
delirium:~ postgres$ echo $PGDATA

Why won't these databases die?



Answer



You can always do a lsof | grep pg or something like that (Postgres) to see if there's anything open by some postgresql related process. pg is rather vague but I'm sure it won't be too much to sift through.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...