Tuesday, April 30, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 15507  / 2 Years ago, tue, may 10, 2022, 1:05:53

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.


More From » postgresql

 Answers
1

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 not 8.4 - use your version`) still exists, you can find a line like




data_directory = '/var/lib/postgresql/8.4/main' # use data in another directory




There 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 like deluser --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. (Use find / -nouser -nogroup - and again, read man find:-) )



For more information, consult the wonderful postgresql documentation.


[#37027] Wednesday, May 11, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ibuteking

Total Points: 35
Total Questions: 128
Total Answers: 138

Location: Indonesia
Member since Thu, Oct 1, 2020
4 Years ago
;