27px
27px

Reputation: 477

How to change default username of postgres (not rename username postgres to something) in windows

When I login to postgres in Windows cmd using psql command it by default tries to login to the user name ADMIN which is my windows user account name, and such user name actually does not exist in the database, I know how to change that by -U attribute like this psql -U postgres. I want to login with user name postgres by default without specifying in the command prompt. like changing any configuration files etc. How do I do that ?

Upvotes: 1

Views: 3252

Answers (1)

Twenkid
Twenkid

Reputation: 955

That thread suggests by setting an environment variable:

https://superuser.com/questions/1278748/postgresql-on-windows-psql-expects-me-to-log-in-with-my-windows-account

The PGUSER environment variable is considered when the -U option is not set.

So you may use a batch file essentially doing:

set PGUSER=postgres
psql

Upvotes: 3

Related Questions