Open Source Computing and GIS in the UK

Travels in a digital world

Thursday Tip Day: Running PostgreSQL Without Making It a Service

| Comments

PostgreSQL from 8.2 onwards can be run easily from the command line in windows, without setting up as a service.

Go to your postgresql/bin folder and at a command line type:

pg_ctl start -D location\of\your\data\folder (as specified in initdb) -l logfile

This should output a notice telling you whether the server has started up correctly. It also saves output to a logfile in the bin folder. If the server starts without incident, open another command window at the same location and type:

psql -d yourdatabase

This will allow you to use PostgreSQL as a command line tool.

To stop the server, type (in your second command window):

pg_ctl stop -D location\of\your\data\folder

Comments