I have messed around with the template1 database, and would like to reset everything as it was.
Hence I have done a sudo apt-get purge postgresql
However the next time I reinstalled it, the databases are still there. Why? Nothing has been reset.
I have messed around with the template1 database, and would like to reset everything as it was.
Hence I have done a sudo apt-get purge postgresql
However the next time I reinstalled it, the databases are still there. Why? Nothing has been reset.
When you create your databases, the datafiles for this databases are created. These are (of course) not being purged by apt purge.
If
/etc/postgresql/8.4/main/postgresql.conf
(presumably it is not8.4
- use your version`) still exists, you can find a line likeThere you can find the datafiles for your created databases. If you created your own data directories, I believe you remember where they were.
Does the user
postgresql
still exist? This is the owner of the database files. Delete this user with searching for all his files (use sth likedeluser --remove-all-files
,man deluser
helps you). If this user does not exist,find
all files in your filesystem that don't have an associated user and maybe delete them. (Usefind / -nouser -nogroup
- and again, readman find
:-) )For more information, consult the wonderful postgresql documentation.
You don't need to puge and re-install PostgreSQL for that.