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
If it is running as a Windows service: Start -> Run -> (then type in:) services.msc. When you see PostgresSQL services set them to manual instead of automatic. 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.
- 5,572
- 4
- 39
- 50
-
1will 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 '18 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. – Dima Korobskiy Aug 08 '19 at 23:13
You can check this out
Type services.msc as previously mentioned and read the path-to-executable as follows;
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.
- 221
- 2
- 4
-
Some comments: 1. for Windows 7 services run `msconfig` 2. cmd run as Admin – Grigory Kislin Jan 18 '22 at 08:07
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 ;)
- 101
- 3
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.
- 9
- 1
-
1How does this prevent postgresql from starting when Windows does? – Andrew Schulman Feb 23 '18 at 09:22