Skip to content

Instantly share code, notes, and snippets.

@danny-andrews
Last active October 10, 2023 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save danny-andrews/09419f81b252c967d747f2f0e0eea00f to your computer and use it in GitHub Desktop.
Save danny-andrews/09419f81b252c967d747f2f0e0eea00f to your computer and use it in GitHub Desktop.
Installing Postgres on Windows

Postgres Setup on WSL

  1. Download Postgres: sudo apt install postgresql.
  2. NOTE: Restart your terminal if you already have it open. And if you're using the terminal in VSCode, you'll have to restart VSCode to have it pick up the changes to the PATH variable.
  3. Run $ psql -U postgres in command prompt. This runs the psql command as the default "postgres" superuser.
  4. Run: postgres=# CREATE USER "[WINDOWS_USERNAME]" WITH PASSWORD '[PASSWORD]' SUPERUSER;
  5. Quit postgres: postgres=# \q
  6. Run psql postgres and type the password you used in the CREATE USER command

Starting/Stopping/Restarting postgres: https://stackoverflow.com/a/53062239

If you get tired of typing your password in everytime you run psql, try one of these options: https://dba.stackexchange.com/questions/14740/how-to-use-psql-with-no-password-prompt.

https://learn.microsoft.com/en-us/windows/wsl/tutorials/wsl-database#install-postgresql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment