Win10 postgresql 安装问题解决

一、环境

本次安装的postgresql 的版本为 10.20.2,安装环境为win10。

二、遇到的问题

1.Problem running post-install step. Installation may not complete correctly. The database cluster initialisation failed.

请添加图片描述
解决办法:找到安装文件夹,查看属性->安全,将所有的用户的权限修改为完全控制。
请添加图片描述

二、Failed to load sql modules。。。以及启动pgAdmin4报错:

could not connect to server: Connection refused (0x0000274D/10061) Is
the server running on host"localhost" (:1) and acceptingTCP/IP
connections on port 5433 ?

could not connect to server: Connection refused (0x0000274D/10061)Is
the server running on host"localhost" (127.0.0.1) and acceptingTCP/IP
connections on port 5433?

解决办法:service.msc 查看服务,看postresql 服务是否存在,如果存在,就启动服务。如果不存在对应的服务,就需要创建服务,本次安装完成后,对应的服务不存在,以下步骤为创建并启动服务。

1. 查找postgresql.conf文件的路径

请添加图片描述
本机的postgresql.conf 文件路径为D:\PostgreSQL\data。

2. 以管理员的身份运行cmd,并进入到安装目录的bin目录下,

请添加图片描述

3. 执行命令

pg_ctl.exe register -N PostgreSQL -D “D:\PostgreSQL\data”

解释:
-N : 表示创建服务的名称
-D :表示postgresql.conf 的文件位置
请添加图片描述

4. 启动服务

上一步创建服务后,可以在服务中查看到对应的服务,启动

请添加图片描述

5. 最终结果

请添加图片描述


版权声明:本文为moderate_people原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。