postgres sql连接失败/没有PostgreSQL服务/忘记密码问题解决

本文档详细介绍了PostgreSQL在Windows环境中遇到的连接失败、服务未注册及忘记密码的问题,并提供了相应的解决步骤。包括重启服务、重新注册服务以及修改配置文件来重置密码的方法,为用户提供了全面的故障排除指南。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

postgres sql连接失败/没有PostgreSQL服务/忘记密码问题解决

1. postgres sql连接失败

报错信息:could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host “localhost” (::1) and accepting TCP/IP connections on port 5432? could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host “localhost” (127.0.0.1) and accepting TCP/IP connections on port 5432?

在这里插入图片描述

解决:

重新启动PostgreSQL服务

在这里插入图片描述

2. 没有PostgreSQL服务问题

  1. 注册表编辑器,删除此文件夹

在这里插入图片描述

  1. 重启

  2. cd到安装目录

    F:\Program Files\PostgreSQL\13\bin
    

    输入以下命令(管理员打开cmd) 注意 -D 后面是data的路径

    pg_ctl.exe register -N "PostgreSQL" -U "NT AUTHORITY\NetworkService" -D "F:\Program Files\PostgreSQL\13\data" -w
    

3. 忘记密码

  1. 找安装目录,按下图修改红框

在这里插入图片描述

  1. 打开pgAdmin,不用输密码就可连上

如何修改密码见这篇文章:https://blog.youkuaiyun.com/u013719339/article/details/51232908

参考文章:

https://stackoverflow.com/questions/27566859/how-to-run-postgresql-as-a-service-in-windows

66859/how-to-run-postgresql-as-a-service-in-windows

https://stackoverflow.com/questions/40532399/unable-to-connect-to-server-for-postgres

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值