PyNoob
PyNoob

Reputation: 223

Cannot Create or Modify pgpass.conf file in %APPDATA%\postgresql directory

So, I want to backup my database using the pgagent.

OS: Windows 10 (64 Bit)

I found out that pgagent is not installed in my environment.

So, I upgraded my pgAdmin to V4.3 and with that I am trying to install pgagent via Stackbuilder's edb_pgagent_pg13 option. The exe is downloaded on my system but when I install it, I get this error:

enter image description here

Then, I saw that there is no folder called postgresql in my APPDATA folder so I created one. "C:\Users\Harshad\AppData\Roaming\postgresql" and then again run the edb_pgagent_pg13.exe

I am still getting the same error.

now, either I don't know how to create the pgpass.conf file or I dont know how to correctly create it.

These steps I followed are:

  1. Creating the postgresql folder in my APPDATA folder
  2. Running the edb_pgagent_pg13.exe as admin
  3. Creating a blank pgpass.conf file in "C:\Users\Harshad\AppData\Roaming\postgresql"

On starting Stackbuilder again as an admin, I chose just the pgagent option but it gives me an error saying incorrect system username and password. It is required for the installation" When I did not get an option to enter credentials.

What should I be doing correctly to get pgagent which will allow me to create and schedule backup jobs?

Edit: Added OS information

Upvotes: 1

Views: 3588

Answers (3)

Drew Alden
Drew Alden

Reputation: 108

Note that this may also be your antivirus (in our case CrowdStrike) killing the pgAdmin installation midway through. You may need to whitelist as appropriate.

Upvotes: 0

true_mogician
true_mogician

Reputation: 738

I faced the same issue when installing pgAgent, and it came down to the Windows Password Policy.

In the final installation step, you are asked to provide an OS account for the service. By default, it uses "postgres", which is the account created by PostgreSQL. In my case, I didn't have an account named "postgres", suggesting that PostgreSQL might not always create this account during installation. This might be version-specific behavior (I used PostgreSQL 13 and 15).

If the account isn't present, the installer will create it. I ran into a hurdle here: my Windows Server 2019 had the "password must meet complexity requirements" policy enabled. The password I provided didn't fulfill these requirements, leading to a failure in account creation and the subsequent error you mentioned.

For those in a similar predicament, here are a few validated solutions:

  • Use a password complying with the complexity requirement during installation.
  • Disable the complexity requirement policy (although this isn't advisable).
  • Rather than allowing the installer to create a new account, supply the credentials of an existing one.

Upvotes: 1

banDeveloper
banDeveloper

Reputation: 38

When you installed PostgreSQL it used 'postgres' Windows account. You need to install pgAgent using this same account.

  1. Start a command prompt and execute 'runas /user:postgres cmd.exe' to run the CMD as the correct user.
  2. Run the pgAgent installation file from that CMD. In my case that was 'D:\Downloads\edb_pgagent_pg13.exe', in your case it's wherever you specified it to be.

That is what worked for me.

Upvotes: 0

Related Questions