Setting up postgres locally on Windows
08-09-2025
- download zipped binaries - https://www.enterprisedb.com/download-postgresql-binaries
- implement folder structure:
pgsql,data,scripts,logs,start.bat,stop.bat - add binary location to PATH
- initialise database
- this will update directory permissions and create config files
initdb -D "C:\Users\lmiloszewski\dev_programs\postgres\17.6-1\data" -U postgresStart script:
@echo off
cd /d "C:\Users\lmiloszewski\dev_programs\postgres\17.6-1\pgsql\bin"
pg_ctl -D "C:\Users\lmiloszewski\dev_programs\postgres\17.6-1\data" -l "C:\Users\lmiloszewski\dev_programs\postgres\17.6-1\logs\postgres.log" start
pauseStop script:
@echo off
cd /d "C:\Users\lmiloszewski\dev_programs\postgres\17.6-1\pgsql\bin"
pg_ctl -D "C:\Users\lmiloszewski\dev_programs\postgres\17.6-1\data" stop
pauseInstalling extensions:
- postgres extensions manager
- visual studio developer command prompt - https://learn.microsoft.com/en-us/visualstudio/ide/reference/command-prompt-powershell?view=vs-2022