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