问题
I've installed pgAgent with the Windows service using a local machine account called postgres. I have confirmed that the Windows service is running normally. I created a job in pgAdmin that should delete certain records from a table in my customer DB. The only step in the job is configured with a Local connection type to the customer DB. The problem is, the job fails every time with the following warning written to the Windows event log:
Failed to create new connection to database 'customer':'fe_sendauth: no password supplied'
I have verified that there is a pgpass.conf file located in C:\Users\postgres\AppData\Roaming\postgresql. Here are its contents:
localhost:5432:postgres:postgres:<password_redacted>
I am not sure what else to try. I have been unable to locate any further information about this error message as it applies to pgAgent.
Version information:
- PostgreSQL 9.2.4, compiled by Visual C++ build 1600, 64-bit
- pgAdmin 1.16.1
- pgAgent v3.3.0-1
Windows service startup information:
C:\Program Files (x86)\pgAgent\bin\pgagent.exe RUN pgAgent host=localhost port=5432 user=postgres dbname=postgres
Non-comment contents of pg_hba.conf:
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
回答1:
What I did was under the step of the job in PgAgentIII
I changed the Connection Type To Remote
Set the Connection String with the button ...
changed the user=postgres to my apps user name
added password=PASSWORD (fill in your password)
change the host=127.0.0.1
I no longer get the error
回答2:
I've bumped into the same problem with pgAgent job step configured for local connection:Failed to create new connection to database '<database_name>':'fe_sendauth: no password supplied'
Solution with putting password into connection string works fine, but seems insecure.
After digging around I've found another solution - adding connection string to pgpass.conf for step's target database solve the issue:localhost:5432:<database_name>:postgres:<password>
回答3:
Make sure to check that the username the pgadmin service and the username of the pgpass.conf file you are checking match. I had the same problem until I realized the pgadmin installer had set the service to run as a local user, and I was checking the pgpass.conf for the same username as a domain user.
来源:https://stackoverflow.com/questions/15867145/pgagent-job-fails-with-authentication-error