当我尝试在 Windows 计算机上安装 PostgreSql 11/12 时,出现以下错误:
初始化数据库集群时出错
以下是详细信息——
端口号 - 5432
安装位置 - 我尝试将其安装在 C:/ProgramFiles 中,也尝试直接安装在 C 盘中
密码 - test123
我以管理员身份运行安装程序
我也可以访问 Temp 目录。
我尝试将数据文件夹移到主文件夹之外。
以下是我尝试过的解决方案 -
- Sol 1 https://postgresrocks.enterprisedb.com/t5/PostgreSQL/Installing-PostgreSQL-12-on-Windows-fails-when-initialising-the/td-p/4511/
- Sol 2 https://stackoverflow.com/questions/32453451/postgres-installation-the-database-cluster-initialization-failed-postgresql-ve
以下是日志文件中的错误:
Error running cscript //NoLogo "C:\pg/installer/server/initcluster.vbs" "NT AUTHORITY\NetworkService" "postgres" "****" "C:\Users\u6105742\AppData\Local\Temp/postgresql_installer_2714a75545" "C:\pg" "C:\pg\data" 5432 "DEFAULT" 0: Program ended with an error exit code
Problem running post-install step. Installation may not complete correctly
The database cluster initialisation failed.
Executing icacls "C:\Users\u6105742\AppData\Local\Temp/postgresql_installer_e172900ce0" /inheritance:r Script exit code: 0
有人可以帮我解决这个问题吗?
在 Windows 上,我通常不再使用安装程序,因为它尝试正确设置权限是值得称赞的,但似乎产生的问题比它解决的问题还要多(特别是对于 Windows 域的一部分似乎遭受此问题的计算机)。
手动运行initdb
似乎更强大,但你will必须自己修复数据目录的权限,例如:
"c:\Program Files\PostgreSQL\12\bin\initdb" -D C:\pg\data
如果您想要 Windows 服务,可以使用 pg_ctl 来完成:
"c:\Program Files\PostgreSQL\12\bin\pg_ctl" register -N postgresql-12 -D C:\pg\data
Windows 服务将使用 Windows 运行“本地系统” https://learn.microsoft.com/en-us/windows/win32/ad/the-localsystem-account有时会看到的帐户同样危险 https://stackoverflow.com/questions/510170- 但并不像 SO 答案中描述的那么危险,因为 Postgres 在启动服务时会放弃所有提升的权限。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)