The postgresql-x64-9.6 service on local computer started and then stopped. Some services stop automatically if they are not in use

Viewed 46276

Postgresql service not starting in services.msc. it is showing below message while starting PostgreSQL service in Window server 2008 R2.

" The postgresql-x64-9.6 service on local computer started and then stopped. Some services stop automatically if they are not in use by other services or programs."

image

13 Answers

I had this same issue. and i followed @Craig Ringer's advice. when i check the event viewer i got this error.2018-06-18 12:34:11.222 GMT [4200] FATAL: lock file "postmaster.pid" already exists 2018-06-18 12:34:11.222 GMT [4200] HINT: Is another postmaster (PID 6172) running in data directory "C:/Program Files/PostgreSQL/10/data"? so i deleted the "postmaster.pid" file in my postgreSQL data directory, start the service again and this time around, the service started properly. This error might be due to incomplete shutdown of the postgreSQL service.

For some reasons postgresql process is still running in the background.

You can encounter this problem if your system forcefully shutdowns down. Solution:

  1. Windows + X (Open task Manager - Processes)

  2. Find all running postgresql services and 'End Task'.

After all processes have ended. You can reopen task manager to ensure no postgres services is running.

  1. Restart Postgresql server

I've solved same issue. Here I have done. I deleted two files and then restart service. Please these files:postmaster.opts, postmaster.pid in "C:/Program Files/PostgreSQL/10/data" directory. As you seen @Abodesegun Ezekiel's answer, I deleted one more file called "postmaster.opts" and it worked for me.

Hope it will be helpful.

I have an additional answer to the ones here as to why the somewhat misleading error message can occur, which is now a newer version, 12.2 vs 9.6, ("The postgresql-x64-12 - PostgreSQL 12 Server service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs.)

Apparently, errors in the pg_hba.conf file will cause the error message above to appear, and the service failed to start.

In my case, I had edited the file and failed to comment out (#) a comment properly. After much Googling, I never saw that mentioned but DID finally remember to double-check my edits, and there the problem was a simple mistake.

I fixed it and the service now starts, no problem.

-Windows 10 x64 Enterprise 1909 18363.752 -PostgreSQL 12.2 (Windows)

My problem was solved by changing the account that runs the service to "Local System" and after that, I was able to start the service.

Encountered this error on postgresql-x64-10, with the following logged on the Windows Event viewer (Windows logs -> Application):

  • Info: Waiting for server startup...
  • Error: postgres: could not access directory ".../PostgreSQL_10_data": No such file or directory
  • Error: Run initdb or pg_basebackup to initialize a PostgreSQL data directory.
  • Error: Timed out waiting for server startup

The problem in this case turned out to be that the data directory identified in the error was on a portable disk that had gotten disconnected. Once the disk was connected back to the system, the postgres service started fine.

Came across the same error with Postgresql-9.4 in Windows-10.

In my case I have a few manual config updates made in postgresql.conf file, and had to validate the syntax of the configuration changes made in the postgresql.conf file. I've followed the below steps that fixed the issue.

  • Delete the postmaster.pid file in %POSTGRESQL-HOME%/9.4/Data/ directory
  • Provide correct syntax (or references) in postgresql.conf and pg_hba.conf files
  • Restart the Postgresql service

For me, deleting the files did not work. But restarting the machine after changing the postgres log-on user to 'local system' worked.

This can also happen when you have 2 versions installed (say 10 and 11). So, there can be some situations where you want to run 11 but 10 has been started and running already.

So what you want to do is stop 10 and try to start 11. In windows you can do by, go to run -> then type services.msc and find 2 services listed and you can then stop and start.

for me just remove som file in the C:\Program Files\PostgreSQL\12\data which 12 is my version the name of the file is =>postmaster.pid and the postmaster.conf then try to run service agine I think it will be work

In my case this error was caused by editing shared_buffers and work_mem parameters in postgresql.conf file to too high values, lowering them solved the issue

Related