0

When using the windows installer found on postgresql.org, the installer has a step asking you to provide a superuser password for the default postgres user.

Asks for a preferred database superuser password

When using the winget package manager for windows, this step is completely skipped. Is there any way to provide a default password to use when installing via winget? Is there one already provided?

$ winget install -e --id PostgreSQL.PostgreSQL

(This directly installs postgres and does not prompt for a password)

Gav Hern
  • 76
  • 1
  • 7
  • Does winget even initdb a database for you and start it up, or does it just install the binaries? If the latter, there is nothing to set a password on, it would be up to you to do it (or to choose a non-password method) when you initdb. – jjanes Jul 02 '22 at 11:35
  • @jjanes, I believe that the OP is talking about the password dialog found here [EDB install](https://www.enterprisedb.com/docs/supported-open-source/postgresql/installer/02_installing_postgresql_with_the_graphical_installation_wizard/01_invoking_the_graphical_installer/) `Fig. 5: The Password dialog`. This is used later for both the Postgres database user `postgres` and the `postgres` Windows service account. – Adrian Klaver Jul 02 '22 at 15:59
  • Right, but he isn't directly using EDB's installer, he is comparing its behavior to winget's. – jjanes Jul 02 '22 at 16:37
  • @jjanes i'm not totally sure but when running `psql` or opening pgAdmin, it asks for the password to the postgres default user when i was never prompted to provide one. i would assume that it provides one by default but i cannot find that posted anywhere. – Gav Hern Jul 02 '22 at 17:59
  • What you have found is you should not be using `winget`. Use the EDB installer and move on. – Adrian Klaver Jul 02 '22 at 21:58
  • @AdrianKlaver I am trying to set up a script that will install everything for a development environment as per request from my boss. It would be much easier to do that and i may have to bring up that it is overcomplicating the issue, but i wanted to check if there was a way to do this before i come to that conclusion. – Gav Hern Jul 03 '22 at 22:05
  • https://stackoverflow.com/questions/27107557/what-is-the-default-password-for-postgres – Demitrius Nelon Jul 06 '22 at 16:23

1 Answers1

0

When in unattended mode, as winget would install it, I believe the password is the same as the username. In this case, it would be postgres when the application is installed using winget.

Trenly
  • 158
  • 6
  • I receive `FATAL: password authentication failed for user "postgres"` – Gav Hern Jul 27 '22 at 20:55
  • Interesting. When I install postgres on Windows using winget, it allows me to use the username `postgres` and the password `postgres` for the default instance it brings up as well as for the PgAdmin – Trenly Jul 27 '22 at 21:08
  • Yeah that is odd... I think what I have learned from this is that winget probably shouldn't be used for a postgres installation – Gav Hern Jul 27 '22 at 21:18