0

I have screwed up my access to local postgresql installation by altering postgres user password to null and now i am unable to access postgresql at all. I have already fixed up my pa_hba.conf to trust as follows:

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all             all                     trust
# IPv4 local connections:
host    all             all             0.0.0.0/32              trust
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     trust
host    replication     all             127.0.0.1/32            trust
host    replication     all             ::1/128                 trust

I have restarted postgres with brew services restart postgres and that didn't work... so I just rebooted my Mac... that also didn't work.

my authentication attempts look like this:

psql -U postgres
Password for user postgres:
psql: FATAL:  password authentication failed for user "postgres"

psql -U postgres
Password for user postgres:
psql: fe_sendauth: no password supplied

I did notice that the following:

which postgres
/usr/local/bin/postgres

/usr/local/bin/postgres does not exist and the config that I'm modifying is located at /usr/local/var/postgres/pg_hba.conf

Prerequisite information:

postgres --version
postgres (PostgreSQL) 11.1

OS: MacOS

1 Answer 1

1

So, I figured it out...

First I had to go through the following in order to completely purge my system of PG: http://hzchirs-blog.logdown.com/posts/142678-how-completely-uninstall-postgresql-9x-on-mac-osx

Next, I had the following error:

psql: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432”?:

The above error was not solvable via any available online miethod that I could find... which was all leeding me to delete a postmaster.pid file which did not exist in the first place...

The solution for the above was to add the 127.0.0.1 localhost.localdomain localhost stanza to my host file, which come to find out, I was missing almost all of my host file entries that i cared so deeply about (I blame the security team for pushing their stupid updates)...

After that, I was finally able to run pg_ctl -D /usr/local/var/postgres -l logfile start and start-up psql, then log in and set up my users/DBs with psql postgres.

Before solving the above issue, I was seeing could not translate host name "localhost", service "5432" to address: nodename nor servname provided, or not known

Buuut it's working now folks!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.