I've followed some questions for uninstalling postgres sql on mac and can't figure out how to deal with not being able to delete the data directory. My issue is I installed it a while back but don't remember the password and the thinking is to uninstall it unless someone can tell me how to reset the password. I see a mac user account for postgres was created and after resetting the password through mac preferences I sill cannot get access to the db or connect via JDBC. Please help!
-
FYI: See more recent Question on uninstalling Postgres from macOS on the sister site: dba.stackexchange.com/q/185476/19079Basil Bourque– Basil Bourque2019-04-06 18:09:58 +00:00Commented Apr 6, 2019 at 18:09
-
See related discussion on similar Question: stackoverflow.com/q/54844651/642706Basil Bourque– Basil Bourque2019-04-06 18:16:36 +00:00Commented Apr 6, 2019 at 18:16
1 Answer
You can't access your db as system user is not the same user as user in postgresql.
It is hard to tell where is data directory, while not knowing how you have installed it in first place. It is possible that you have PGDATA environment variable set. You can check it by running following command in the console:
echo $PGDATA
If it is empty you can check possible data directory locations i.e. with find command:
sudo find / -name PG_VERSION
It is file that should be in postgresql database directory according to postgres documentation: http://www.postgresql.org/docs/8.4/static/storage-file-layout.html
You can also check this answer, if you don't want to uninstall and remove data directory: How do I reset the postgresql 9.2 default user (usually 'postgres') password on mac os x 10.8.2?