在 Windows 10 上安装 PostgreSql 12 时出现数据库集群错误 [英] Getting Database cluster error while installing PostgreSql 12 on Windows 10
问题描述
当我尝试在 Windows 机器上安装 PostgreSql 11/12 时,出现以下错误:
When I tried to install PostgreSql 11/12 on my windows machine I was getting the below error :
初始化数据库集群时出错
以下是详细信息-端口号 - 5432安装位置 - 我尝试将其安装在 C:/ProgramFiles 中,也尝试将其直接安装在 C 驱动器中密码 - test123我以管理员身份运行安装程序我也可以访问 Temp 目录.我曾尝试将数据文件夹移到主文件夹之外.以下是我尝试过的解决方案 -
Below are the details - Port No - 5432 Installation Location - I have tried installing it in C:/ProgramFiles and also directly in C drive Password - test123 I am running the installer as administrator I have access to Temp directory as well. I have tried moving data folder outside of the main folder. Below are the solutions I have tried -
以下是日志文件中的错误:
Below is the error in log file:
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
有人可以帮我解决这个问题吗?
Could someone please help me in this issue?
推荐答案
在 Windows 上,我通常不再使用安装程序,因为它尝试正确设置权限是值得称赞的,但似乎产生的问题比它解决的要多(尤其是在Windows 域的一部分似乎受此影响的计算机).
On Windows I typically don't use the installer any more as its attempt to set privileges correctly is laudable but seems to create more problems than it solves (especially with computers that a part of a Windows domain seem to suffer from that).
手动运行 initdb
似乎更健壮,但您将必须自己修复数据目录的权限,例如:
Manually running initdb
seems to be more robust, but you will have to fix the permissions on the data directory yourself, e.g.:
"c:\Program Files\PostgreSQL\12\bin\initdb" -D C:\pg\data
如果你想要一个 Windows 服务,可以使用 pg_ctl 来完成:
If you want a Windows service, this can be done using pg_ctl:
"c:\Program Files\PostgreSQL\12\bin\pg_ctl" register -N postgresql-12 -D C:\pg\data
<小时>
Windows 服务将使用 Windows "本地系统" 帐户有时被视为危险 - 但并不像那个 SO 答案中描述的那样危险,因为 Postgres 在启动服务时会放弃所有提升的权限.
The Windows service will run using the Windows "Local System" account which sometimes is seen as dangerous - but isn't as dangerous as described in that SO answer, because Postgres will drop all elevated privileges when it starts the service.
这篇关于在 Windows 10 上安装 PostgreSql 12 时出现数据库集群错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!