PostgreSQL:数据库集群初始化失败

Lar*_*tel 16 postgresql windows

双方C:\PostgreSQLC:\PostgreSQL\data拥有postgres完全访问和管理权限的用户。

我以管理员身份从 postgres 用户运行 postgresql-9.1.2-1-windows.exe。目标C:\PostgreSQL

我尝试的每一种方式都得到“数据库集群初始化失败”。

问题

  • 可以在不作为 Windows 服务的情况下运行所有​​内容吗?
  • 是否有解决方法可以安装为 Windows 服务?

我正在尝试设置 PostGIS 以与 GeoDjango 一起使用。

我能够手动安装 PostGIS。我是 PostgreSQL 的新手,我对所有这些都感到信心危机。第一次从 MySQL 到 PostgreSQL。


来自 C:\Users\Larry\AppData\Local\Temp\install-postgresql.log 的相关日志输出:

WScript.Network initialized...
Called IsVistaOrNewer()...
    'winmgmts' object initialized...
    Version:6.1
    MajorVersion:6
Ensuring we can read the path C: (using icacls) to Larry:
    Executing batch file 'radA3CF7.bat'...
    Output file does not exists...
Called IsVistaOrNewer()...
    'winmgmts' object initialized...
    Version:6.1
    MajorVersion:6
Ensuring we can read the path C:\PostgreSQL (using icacls) to Larry:
    Executing batch file 'radA3CF7.bat'...
    Output file does not exists...
Called IsVistaOrNewer()...
    'winmgmts' object initialized...
    Version:6.1
    MajorVersion:6
Ensuring we can read the path C:\PostgreSQL\data (using icacls) to Larry:
    Executing batch file 'radA3CF7.bat'...
    Output file does not exists...
Called IsVistaOrNewer()...
    'winmgmts' object initialized...
    Version:6.1
    MajorVersion:6
Ensuring we can write to the data directory (using icacls) to  Larry:
    Executing batch file 'radA3CF7.bat'...
    Output file does not exists...
Failed to ensure the data directory is accessible (C:\PostgreSQL\data)
    Executing batch file 'radA3CF7.bat'...
    Output file does not exists...
Called Die(Failed to initialise the database cluster with initdb)...
Failed to initialise the database cluster with initdb
Run Code Online (Sandbox Code Playgroud)

建议?

小智 20

我在 Windows 7 上安装 9.1.4 时遇到了同样的问题。我设法在网上找到了一个有效的解决方案

我遵循的步骤是:

  1. 卸载 PostgreSQL
  2. 删除 postgres 用户(如果它仍然存在)。

    net user postgres /delete
    
    Run Code Online (Sandbox Code Playgroud)
  3. 使用您可以记住的密码创建 postgres 用户

    net user /add postgres <password>
    
    Run Code Online (Sandbox Code Playgroud)
  4. 将 postgres 用户添加到管理员组

    net localgroup administrators postgres /add
    
    Run Code Online (Sandbox Code Playgroud)
  5. 将 postgres 用户添加到 Power Users 组

    net localgroup "power users" postgres /add
    
    Run Code Online (Sandbox Code Playgroud)
  6. 以 postgres 用户身份运行命令窗口

    runas /user:postgres cmd.exe
    
    Run Code Online (Sandbox Code Playgroud)
  7. 从命令窗口中运行安装文件。

    C:\Download\postgresql-9.1.4-1-windows.exe
    
    Run Code Online (Sandbox Code Playgroud)

    这应该会成功运行安装。

  8. 从管理员组中删除 postgres 用户。

    net localgroup administrators postgres /delete
    
    Run Code Online (Sandbox Code Playgroud)

  • 这个程序并没有为我解决这个问题。我在安装过程中仍然收到集群初始化失败的消息。 (2认同)