8

Various guides show how to install/start postgres on mac using brew:

brew install postgresql
brew services start postgresql

However the usual next step, to connect with an empty password, fails.

psql postgres
Password for user <>:
psql: fe_sendauth: no password supplied

How do you connect to a newly created postgres 11 database on mac in 2019?


Prior research:

It looks like the default password used to be empty.

The official wiki guide, and Recent/fairly recent tutorials suggest psql<databasename> should just work, but these fail with the above errors.

An older guide and newer SO answer have you switch user before using psql, which gives the same error as above.

Jethro
  • 3,029
  • 3
  • 27
  • 56
  • 1
    Note the official wiki seems to have a typo: i'm replacing `pgsql` with `psql`. The recent guide inclused creating a database as a step, and instead fails with `createdb: could not connect to database template1: FATAL: password authentication failed for user`. The service is always started after installing: ```brew services start postgresql``` ```Service `postgresql` already started, use `brew services restart postgresql` to restart.``` – Jethro Aug 21 '19 at 15:10
  • still not answered... yikes. I don't know if it will help now but you could try adding tags such as your operating system or brew to bring it to a wider pool of potential answerers – Cheetaiean Jun 04 '20 at 20:29

2 Answers2

1
  1. login on your machine in a shell as „root“

  2. change to the „postgres“ user:

$ su - postgres (no password required because you are root)

  1. run psql

$ psql

Hechi
  • 456
  • 5
  • 9
1

I had the same problem with a brew installed Postgres@14. The following got me into the DB shell:

psql -h localhost -d postgres
Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
wessel
  • 11
  • 2