在 Windows 10 上安装 PostgreSQL 时出错:Warning:Problem running post-install step. Installation may not complete correctly Failed to start the database server.

时间:2020-03-23
本文章向大家介绍在 Windows 10 上安装 PostgreSQL 时出错:Warning:Problem running post-install step. Installation may not complete correctly Failed to start the database server.,主要包括在 Windows 10 上安装 PostgreSQL 时出错:Warning:Problem running post-install step. Installation may not complete correctly Failed to start the database server.使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

错误信息

Warning
Problem running post-install step. Installation may not complete correctly
Failed to start the database server.

解决方案

方案 1(推荐)

安装 PostgreSQL 到 WSL 上,参考 https://gist.github.com/michaeltreat/40a2f444d8ff6c89af958733448da093

方案 2

手动创建 postgres 用户,然后执行安装操作。具体步骤如下:

  1. 删除已经安装的 PostgreSQL,删除安装目录的文件

  2. 检查是否有 postgres 用户,如果有,则删除 postgres 用户。或者执行下面的脚本直接删除

net user postgres /delete
  1. 创建 postgres 用户,并加入到 Administrators 和 power user 组
net user /add postgres <password>

net localgroup administrators postgres /add

net localgroup "power users" postgres /add
  1. 使用 postgres 用户运行 cmd.exe
runas /use:postgres cmd.exe
  1. 执行安装
.\postgresql-12.x.x-windows-x64.exe
  1. 从 Administrators 用户组中移除 postgres 用户
net localgroup administrators postgres /delete

参考

原文地址:https://www.cnblogs.com/nehcdahc/p/12550388.html