Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Installing Postgres on Windows

Postgres Setup on Windows

  1. Download Postgres installer.
  2. Run installer.
    1. Keep all default options selected (PGAdmin, command line tools, etc.)
    2. Keep port at default: 5432
  3. Navigate to the directory where you installed postgres, and enter the bin directory (should be something like C://Program Files/PostgreSQL/[VERSION_NUM]/bin). Copy this file path and add it to your PATH environment variable.
  4. 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.
  5. Run $ psql -U postgres in command prompt. This runs the psql command as the default "postgres" superuser.
  6. Type password you used during install.
  7. Run: postgres=# CREATE USER "[WINDOWS_USERNAME]" WITH PASSWORD '[PASSWORD]' SUPERUSER;
  8. Quit postgres: postgres=# \q
  9. 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.

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