1

I am getting an error when attempting to upgrade a PostgreSQL installation. The full error is:

A data directory is registered in ***unknown variable postgresqlini*** but is neither empty or a recognized data directory

I've already had a look at this issue, which seems to be the only other one I can find which is related, but it did not help me. As you can see, my paths are surrounded by quotation marks.

Here is the full command that is run (separated to multiple lines to make it readable)

"C:\ProgramData\Package Cache\44103BBE02C9C99CB868F4767B0CC3B5D50B6C09\postgresql-10.11-1-windows-x64.exe"
--unattendedmodeui minimal
--mode unattended
--servicename RM_Postgresql
--servicepassword xyz
--superpassword xyz
--prefix "C:\Program Files\\company\postgres"
--datadir "C:\Program Files\\company\data"
--disable-components stackbuilder

This command is part of an installer which launches the PostgreSQL installer. I've been running the same command for nearly 2 years without any issues (using different versions of PostgreSQL on different computers). For some reason, it seems to now be failing on one of our machines, and I am unsure as to why.

The currently installed version of PostgreSQL on the computer where it is failing is 10.6-1, and I am attempting to update to 10.11-1 if that makes any difference.

This now seems to cause issue with the previous installation as well:

initializeDatabase fail on opening postgres msg=could not connect to server: Connection refused (0x0000274D/10061)
    Is the server running on host "localhost" (::1) and accepting
    TCP/IP connections on port 5432?
could not connect to server: Connection refused (0x0000274D/10061)
    Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on port 5432?
QPSQL: Unable to connect
4
  • 1
    don't put the data directory into c:\Program Files, that's a really bad idea to begin with. Stuff like that should be stored in %ProgramData% in modern Windows versions
    – user1822
    Feb 18, 2020 at 13:02
  • Curious, but why? Always done that for the installations, and it's never been an issue?
    – ChrisMM
    Feb 18, 2020 at 13:03
  • c:\Program Files should only store binaries of the application, not data. It's write protected for non-admin users for a reason.
    – user1822
    Feb 18, 2020 at 13:04
  • Thanks. I'll keep that in mind, and try to change for new installations.
    – ChrisMM
    Feb 18, 2020 at 13:09

1 Answer 1

0

Same issue here while installing postgresql-12.4-1-windows-x64.exe

A data directory is registered in ***unknown variable postgresqlini*** but is neither empty or a recognized data directory

After deleting the folder: c:\Program Files\PostgreSQL\12\, the installation went through.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.