PostgreSQL 连接不到数据库

发布于:2023-09-14 ⋅ 阅读:(78) ⋅ 点赞:(0)

正常登录pgAdmin4时,连接数据库,所有密码都正确,但出现一段英文提示:

“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-x64-13,又出现新的错误提示:

然后去查问题的原因,看到了这篇博客本地计算机上的 postgresql 服务启动后停止解决方法_postgresql 启动后停止__苏沐的博客-CSDN博客。大概猜到应该是我存储数据的目录变更导致的这个错误。解决方法,(1)把目录名保存回来;(2)修改PostgreSQL的数据存储目录。

我选择去修改数据存储路径。

方法参考这里:https://www.cnblogs.com/telwanggs/articles/13231670.html

修改注册表:

对应键值位置在"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\postgresql-x64-9.5\ImagePath",将“-D”后的目录名修改为新的数据目录位置即可,如果目录路径中含有空格,需要用引号引起。


网站公告

今日签到

点亮在社区的每一天
去签到