错误信息:
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?
一般为安装时出错,导致data目录下无文件
或者为 PostgreSQL服务未启动
解决方式有以下步骤:
1.在安装的路径下找到bin目录,默认安装路径为:D:\Program Files\PostgreSQL\11\bin
CMD到当该目录下
2.修复data目录
用cmd执行以下命令:
.\initdb.exe -E UTF-8 -D ..\data
1
3.注册 PostgreSQL服务
用cmd执行以下命令:
.\pg_ctl.exe register -D ..\data
1
4.启动PostgreSQL服务
用cmd执行以下命令:
.\pg_ctl.exe start -D ..\data
1
5.创建postgres角色
用cmd执行以下命令:
createuser -s postgres
1
之后即可连接本地服务器
————————————————
版权声明:本文为优快云博主「不印良品」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.youkuaiyun.com/qq_36294121/article/details/117654849