Skip to content

Instantly share code, notes, and snippets.

@tlylt
Created May 21, 2020 08:50
Show Gist options
  • Save tlylt/471e7ca98b572fb69e81a67d91edc916 to your computer and use it in GitHub Desktop.
Save tlylt/471e7ca98b572fb69e81a67d91edc916 to your computer and use it in GitHub Desktop.
https://serverfault.com/questions/110154/whats-the-default-superuser-username-password-for-postgres-after-a-new-install
In Windows, do the following (IMPORTANT: Use a Windows administrator account):
After installation, open <PostgreSQL PATH>\data\pg_hba.conf.
Modify these two lines, and change "md5" to "trust":
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
Restart the PostgreSQL service (might not be necessary).
(Optional) Open a command prompt, and change code page to 1252:
cmd.exe /c chcp 1252
Log in to PostgreSQL. Non password will be needed (notice the uppercase -U parameter):
psql -U postgres
(Optional, recommended for security reasons) Change the postgres user's password:
\password postgres
and change "trust" back to "md5" in pg_hba.conf.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment