windowspostgresqldatabase-backupspgagent

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


Solution

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