I began following https://www.postgresql.org/docs/9.6/runtime.html for setting up a local postgresql server for testing and development purposes. I discovered that I already have the
postgresql package installed, a
postgres user already exists, and there appears to already be a postgresql server listening on
This is strange, because while I've previously used the
psql command to connect to remote postgresql databases, I don't remember ever setting up a local postgresql database.
I tried connecting to the database with
psql -h 127.0.0.1 -p 5432 but I was prompted for a password. Entering a blank password did not work. I also tried becoming the
postgres user with
su postgres, but was again prompted for a password.
I do not know the location of the server's data directory. Creating a Database Cluster recommends using
/usr/local/pgsql did not exist before I created it while attempting to set up a local server.
My ultimate question is:
- Why is there a postgresql server running on my local machine?
Some related questions are:
- How do I locate the server's data directory? (Hopefully it contains logs.)
- How do I determine when the
postgresuser was created?
- How do I recover the passwords for the database and the
- Alternatively, can I view the database's contents without recovering the database password?