35

I have a local postgresql database for development purposes that I dont want to start up every time Windows does - how do I stop it from starting!

4 Answers 4

50

If it is running as a Windows service: Start -> Run -> (then type in:) services.msc. Scroll to PostgresSQL services, double click and set them to manual instead of automatic.

enter image description here

If you do need them again, just fire up services.msc again and click the Start icon/button once you have reselected the PostgresSQL service.

2
  • 1
    will it somehow affect how postgresSQL works? I don't want to have Postgres running in background when I don't need it, but I also need it to work properly when I'm working with it. What will change if I set that service to manual?
    – Piotrek
    Sep 23, 2018 at 10:48
  • 2
    @Piotrek When a service's Startup type set to Manual Windows doesn't start it after reboot. Automatic services are all [attempted to be] started after reboot. Aug 8, 2019 at 23:13
13

You can check this out

Type services.msc as previously mentioned and read the path-to-executable as follows;

Services.msc capture

Path to executable: "C:\Program Files\PostgreSQL\9.3\bin\pg_ctl.exe" runservice -N "postgresql-x64-9.3" -D "C:/Program Files/PostgreSQL/9.3/data" -w

Net service name is defined as postgresql-x64-9.3

So simply, whenever I want to shut down postgresql, I just type the following on a command line instance (to create a cmd instance, type windows+r and enter cmd);

net stop postgresql-x64-9.3

If you run another version of postgresql, you can just check the service name as explained and use this as a shortcut. Hope that it helps.

1
  • Some comments: 1. for Windows 7 services run msconfig 2. cmd run as Admin Jan 18, 2022 at 8:07
1

The accepted answer didn't work for me because everything is greyed out and I can't disable anything.

If you have the same issue, it could be due to privileges.

You will need to launch CMD as an admin user:

  • Open Start, type: CMD
  • Right click CMD
  • Click Run as administrator

Then you can disable PostgreSQL by running the following commands:

sc stop postgresql-x64-13
sc config postgresql-x64-13 start=disabled

Replace 13 with your PostgreSQL version number. You can find the service name by running:

sc query

Of course the better solution is to install Linux ;)

-2

This question is old and already answered, but this might help someone. From Windows Command line Start: NET START postgresql-x64-9.2

Stop: NET STOP postgresql-x64-9.2

Change your version and windows. This is for 64-bit windows, version 9.2.

1
  • 1
    How does this prevent postgresql from starting when Windows does? Feb 23, 2018 at 9:22

You must log in to answer this question.