Skip to main content

Stopping and Starting Postgres SQL Database Server

  1. Go to the Postgres installation bin directory, which would be something like
    • C:\Program Files\PostgreSQL\9.5\bin
  2. In the windows explorer path, type "cmd" and press Enter to launch Command Prompt window.
  3. Command to Stop the Postgres Database Server
    • pg_ctl -D "..\data" stop
  4. Command to Start the Postgres Database Server
    • pg_ctl -D "..\data" start
  5. Command to Restart the Postgres Database Server
    • pg_ctl -D "..\data" restart
You might need to keep the above command line window open for the database to continue working. If anyone has found an alternative to avoid keeping the window open, please let me know in the comments.

Note: If you are facing any issues, you need to run the Command Prompt as administrator and use the below command to switch to the Postgres bin directory and then use the above command.
    •  cd C:\Program Files\PostgreSQL\9.5\bin
 

Comments