阅读背景:

【PostgreSQL】Windows安装教程

来源:互联网 

目录 PostgreSQL Server下载 安装PostgreSQL Server

PostgreSQL Server下载 官网下载页面: https://www.postgresql.org/download/ EDB下载页面: https://www.enterprisedb.com/downloads/postgres-postgresql-downloads 15.3版本下载地址: https://get.enterprisedb.com/postgresql/postgresql-15.3-2-windows-x64.exe 安装PostgreSQL Server 运行安装程序,根据提示一步步安装 安装过程会提示设置密码: 123456 假设安装的位置在: D:\ProgramFiles\PostgreSQL 进入bin目录: cd D:\ProgramFiles\PostgreSQL\bin 初始化数据库: initdb -D "D:\ProgramFiles\PostgreSQL\data" -E UTF8 -U postgres --locale="Chinese (Simplified)_China.936" --lc-messages="Chinese_China.936" -A scram-sha-256 -W 启动: pg_ctl -D "D:\ProgramFiles\PostgreSQL\data" start 停止: pg_ctl -D "D:\ProgramFiles\PostgreSQL\data" stop 注册Windows服务: pg_ctl.exe register -D "D:\ProgramFiles\PostgreSQL\data" -PostgreSQL 默认情况下 PostgreSQL 数据库只能本机连接,我们调整为监听所有 IP 开启外部连接的功能 在D:\ProgramFiles\PostgreSQL\data文件夹中找到postgresql.conf 找到#listen_addresses = 'localhost' 增加一行: listen_addresses = '*' 在D:\ProgramFiles\PostgreSQL\data文件夹中找到pg_hba.conf,参考下面修改 # IPv4 local connections: #host all all 127.0.0.1/32 scram-sha-256 host all all 0.0.0.0/0 scram-sha-256 # IPv6 local connections: #host all all ::1/128 scram-sha-256 host all all ::/0 scram-sha-256 通过Windows服务启动: net start PostgreSQL 通过Windows服务停止: net stop PostgreSQL 卸载Windows服务: pg_ctl.exe unregister -PostgreSQL Postg



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: