PostgreSQL 9.2.4 (Windows 7) - Service won't start, “could not load pg_hba.conf”

爷,独闯天下 提交于 2019-12-05 03:51:34

The local entry is not supported on Windows machines. See E.20.3.1.3. Authentication.

Reject local lines in pg_hba.conf on platforms that don't support Unix-socket connections (Magnus Hagander)

Formerly, such lines were silently ignored, which could be surprising. This makes the behavior more like other unsupported cases.

Change your configuration from:

local  all    all     trust

to:

host   all    all   127.0.0.1/32  trust
host   all    all   ::1/128       trust

For more info, consult 19.1. The pg_hba.conf File.

I had this problem with Postgresql version 8.3 after installing it on a Windows 7 machine. Initially it was working normally, but suddenly it stopped (probably after some Windows update). Many tentatives were made changing permissions, but it didn't put it to work. Some months later I found the problem in a file which was empty, meanwhile it should have some data. Verify this path: C:\Program Files (x86)\Postgresql\8.3\data\ (where 8.3 must be replaced to your version number). Check if the file Postmaster.pid is empty or not (open it using Wordpad or Notepad). If it is empty, rename it to _Postmaster.pid (or other name). Go to Start menu and at the command box type services.msc Press Enter Locate the Postgresql Database entry Double click on it Click on Start button If the service starts, a new Postmaster.pid will be created (with some data) You can check it in the path indicated above.

The good tip came from analysing the Event Viewer: Open Windows Explorer, select "Computer", right click on "Manage", select "Event Viewer", wait "Summary of Administrative Events" to load, open the "Error" node, locate "PostgreSQL" entry in the "Source" column and doubleclick on it. There was the tip informing bogus data in the Postmaster.pid file.

I hope this information can help you. Cheers! Ed.

The problem is that this postgres version under win7 can not handle local connections. I had to work with pg very urgently on my local computer so I did not care too much about security so maybe this is not the best solution for a live environment. But my local PC it was enough.

I removed all other uncommented lines from pg_hba.conf and left in only the following one:

host    all             all             ::1/0                 trust

After this I could connect via command line.

I do not understand why the manual tells no more about this issue. I am pretty sure many people have problem with this.

I've had the same problem. What worked for me was:

  1. Open the postgresql.conf file (usually, it is located at C:\Program Files\PostgreSQL\9.4\data);
  2. Comment the line number 147 ( shared_preload_libraries = '$libdir/plugins/plugin_debugger.dll')

In such a case the best thing is to analyse the OS logs. For windows, check the "Event Viewer" -> "Application". Such error can occur for various reasons. In my case a postgres was already running. I found out that information in the Windows Logs.

So, quick disclaimer, I now run PostgreSQL on Linux. But, years ago, I did run it on Windows. And I seem to remember this problem. I think the clue is in this line:

2013-05-29 15:07:00 MDT LOG:  local connections are not supported by this build

local connections is a Unix thing. You are using windows. So "not supported by this build". Try changing local to localhost and restart. Here's a enter link description here to a similar problem posted on the Postgres mailing list:

I had made a mistake in postgresql.conf. I had done

max_prepared_transactions = 16*max_connections  # zero disables the feature

where before in this file there is,

max_connections=100

This cannot be done, and the following works:

max_prepared_transactions = 1600    # zero disables the feature

“The Service on local computer started and then stopped ,Some services stop automatically if there are not in use by other services or programs.”

Now I will explain how to solve the Service on local computer started and then stopped, some services stop automatically if there are not in use by other services or programs.

To solve this problem we have two ways

First Way

Start --> Run --> Type Services.msc and click enter button now you will get all the services in your computer after that select your service and right click on that and go to Properties

After that open Select Log On tab in that select Local System Account and click ok now your problem will solve

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!