postgresql安装到auto start时出错

postgresql安装到auto start时出错

Problem running post-install step. Installation may not complete correctly.

第二次安装postgresql的时候,用了几个安装包都出现这个问题,导致无法连接到数据库,打开pgadmin3一直显示连接数据库失败。

参考了修改注册表以及密码设置方面的问题,发现都不是,仔细看之后,发现是跑config的时候出错,打开\log文件夹之后找到installLog.log,找到错误的地方:

Configuring PostgreSQL as auto start
Executing E:\PostgreSQL/pgc config pg96 --autostart on
Script exit code: 1

Script output:
 Error running config-pg96

Script stderr:
 usage: usage: config-pg96.py [-h] [--port PORT] [--autostart={on,off}]
                      [--datadir DATADIR] [--logdir LOGDIR]
                      [--svcname SVCNAME]
config-pg96.py: error: argument --autostart: expected one argument

Error running E:\PostgreSQL/pgc config pg96 --autostart on: usage: usage: config-pg96.py [-h] [--port PORT] [--autostart={on,off}]
                      [--datadir DATADIR] [--logdir LOGDIR]
                      [--svcname SVCNAME]
config-pg96.py: error: argument --autostart: expected one argument
Problem running post-install step. Installation may not complete correctly
 Error running E:\PostgreSQL/pgc config pg96 --autostart on: usage: usage: config-pg96.py [-h] [--port PORT] [--autostart={on,off}]
                      [--datadir DATADIR] [--logdir LOGDIR]
                      [--svcname SVCNAME]
config-pg96.py: error: argument --autostart: expected one argument

也就是说在跑autostart的时候参数设置错了,数据库无法自启动,其实在下面就有应该输入的参数格式。

安装会跑一个config-pg96.py 后面接参数中,autostart的格式应该是autostart=on,但是安装的时候默认使用:

file_path/pgc config pg96 --autostart on

要自己win+R打开cmd,cd 到安装目录,可以找得到一个pgc.bat的文件,在cmd中输入

pgc config pg96 --autostart=on

而假如遇到安装admin3有问题,那就是没法链接到下载地址的网站的问题,自己随便下一个就好。

如果还遇到数据库无法自启动的问题,就启动服务(Win+R services.msc)

找到postgresql server手动打开叭(我也不知道之后能不能自启动。/滑稽)

其他问题可以参考:

The database cluster initialisation failed:

https://blog.csdn.net/baidu_38550825/article/details/79986348

https://www.cnblogs.com/wzjfl21/p/5225350.html