PostgreSQL 在windows 配置

111 阅读1分钟

PostgreSQL支持windows10。

具体的安装方法如下:

1、下载

32位:get.enterprisedb.com/postgresql/postgresql-10.3-1-windows-binaries.zip

64位:get.enterprisedb.com/postgresql/postgresql-10.3-1-windows-x64-binaries.zip

2、解压到:c:\pgsql\

3、设置环境变量(cmd):

setx PGHOME c:\pgsql
setx PGHOST localhost
setx PGLIB %PGHOME%\lib
setx PGDATA %PGHOME%\data
setx Path "%Path%;%PGHOME%\bin"

重新登录

4、初始化数据库

initdb.exe -D c:\pgsql\data -E UTF-8 --locale=chs -U postgres -W

5、注册为系统服务(以管理员权限打开cmd)

pg_ctl register -N PostgreSQL -D c:\pgsql\data

6、修改配置以支持远 程连接

springboot -> fhadmin.cn

6.1 notepad c:\pgsql\data\postgresql.conf

设置:listen_addresses = '*'

6.2 notepad c:\pgsql\data\pg_hba.conf

置ipv4段

   host    all    all    0.0.0.0/0    md5

7、启动服务

net start PostgreSQL

8、关闭防火墙(视情况而定)

netsh firewall set opmode disable