相关文章推荐
买醉的闹钟  ·  Postgresql中JSONB和text的 ...·  1 周前    · 
呐喊的生姜  ·  WPF GroupBox Header ...·  10 月前    · 
苦恼的麦片  ·  Java 异常处理 | 菜鸟教程·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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

Ask Question

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."

@user3931984 - Please ask this question on ServerFault or SuperUser. This is not about a programming problem, so it doesn't belong on SO. antiduh Aug 8, 2017 at 5:42 with details: exact error messages from event viewer and postgres logs. As text not screenshot so they're searchable. Craig Ringer Aug 9, 2017 at 1:29 event log : FATAL: XX000: C:\Program Files\PostgreSQL\13\bin\postgres.exe: could not locate matching postgres executable LOCATION: getInstallationPaths, d:\pginstaller_13.auto\postgres.windows-x64\src\backend\postmaster\postmaster.c:1489 any idea? Hamid Shoja Apr 7, 2021 at 11:16

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.

Event Viewer → Windows Logs → Application. My Error from PostgreSQL says postgres: superuser_reserved_connections (3) plus max_wal_senders (10) must be less than max_connections (10) . Seems I misconfigured the max_connections . Solved, thanks. Константин Ван Jun 21, 2019 at 23:32 And delete postmaster.opts file in same directory as well. Then restart service. It should be fine with out any error. I hope it will be helpful. :) Leon Sep 10, 2020 at 13:11

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

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

  • Windows + X (Open task Manager - Processes)

  • 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.

  • Restart Postgresql server
  • I had the same experience: "postgresql server 14 service on local computer started and then stopped" error, but I can open databases using pgAdmin 4. This solution solved the problem. Thanks jflaga Jul 18, 2022 at 0:53

    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)

    Same thing happened to me. I edited pg_hba.conf and later tried to restart the server it wouldn't run anymore. Had to fix pg_hba.conf to make it work again. So +1. Abdelhakim Feb 7, 2021 at 17:14

    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.

    Similar issue, config error in postgresql.conf. I find the error message a bit misleading. Jorge González Lorenzo Oct 14, 2018 at 10:55

    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, killing the process, deleting the pid file, restart, etc. did not help. What worked was:

    1- Check the status:
    Change the directory to the installation folder and go inside the bin . The path is like:
    C:\Program Files\PostgreSQL\12\bin
    use the pg_ctl to get the status:
    C:\Program Files\PostgreSQL\12\bin>pg_ctl.exe -D "C:\Program Files\PostgreSQL\12\data" status
    The path here is the data folder. The result was:
    pg_ctl: server is running (PID: 7560)
    Even though the service was not running in the windows service page.

    2- Stop:
    C:\Program Files\PostgreSQL\12\bin>pg_ctl.exe -D "C:\Program Files\PostgreSQL\12\data" stop

    3- Start:
    Now you should be able to start the postgres from windows service page or by:
    C:\Program Files\PostgreSQL\12\bin>pg_ctl.exe -D "C:\Program Files\PostgreSQL\12\data" start

    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.

    This same exact solution was posted in this question about 6 months prior to yours; I'd suggested doing a quick scan next time to avoid polluting these pages with dups like this: stackoverflow.com/a/64237242/589509 NOCARRIER Jul 6 at 14:37

    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.

    Hello, adding on this: make sure there is no PostgreSQL process already running in the background by opening Task Manager and searching for PostgreSQL. If found right click -> End Task. Emile ASTIH Aug 2, 2021 at 13:14

    Looks like I had issues in the checkpoint log in the transaction record? (I'd been trying to upgrade from one version to another in Windows, and run into issues)

    Could see the error in the most recent log in the data/log directory

    could not locate a valid checkpoint record

    If so, this answer showed what wound up working for me, using the pg_resetwal command to reset the WAL. I don't believe I ever had to use the -f option (though have closed my terminal history, so can't be sure)

    For a user called jeopardytempest, for me it would be:

    pg_resetwal "C:/users/jeopardytempest/Program Files/PostgreSQL/14/data/"