Windows 10 免安装启动并连接到 Postgre-SQL 服务

1. 下载二进制压缩包

https://www.enterprisedb.com/download-postgresql-binaries

2. 解压后在压缩包的bin目录下执行初始化DB命令

initdb.exe -D .\data -U pguser -W -E UTF8 -A scram-sha-256 --locale=en_US

initdb详细说明文档:https://www.postgresql.org/docs/current/app-initdb.html

3. 启动DB服务

pg_ctl.exe -D .\data -l logs start

4. 连接到DB服务

psql.exe -U pguser -h 127.0.0.1 -p 5432 -d postgres

结束DB服务

pg_ctl.exe -D .\data -m smart stop  # or `-m immediate` without waiting for active connections to finish
posted @   LexLuc  阅读(270)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
点击右上角即可分享
微信分享提示