0

I'm trying to connect to postgres and am getting the password authentication failed for user <myusername>

I have Postico installed and can connect to a database without a password so long as my username is postgres. I used the solution found here to get this to work.

Why postgresql on mac asks me for password after fresh install?

However, in my visual studio code terminal, when I run psql, it's still asking for my password for my username rather than password for 'postgres' user.

How do I change the default user to connect to?

Thank you

1 Answers1

0

As documented in the manual you can specify a different username for psql using the -U parameter

So if you run:

psql -U postgres ...

The connection will be made with the superuser. You will still need to provide a password if password authentication is configured.