win10下搭建PostgreSQL

 win10下搭建PostgreSQLsql

 

参考:数据库

https://blog.csdn.net/chineseboytom/article/details/78868199网络

 

 

 

三、设置环境变量(cmd):post

 

setx PGHOME E:\PostgreSQL\10spa

 

setx PGHOST 192.168.100.157.net

 

setx PGLIB %PGHOME%\libpostgresql

 

setx PGDATA %PGHOME%\datablog

 

setx Path "%Path%;%PGHOME%\bin"ip

 

 

 

从新登陆md5

 

 

 

四、初始化数据库

 

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

 

 

 

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

 

pg_ctl register -N PostgreSQL -D E:\PostgreSQL\10\data

 

 

 

六、修改配置以支持远程链接

 

6.1 notepad D:\Program Files\PostgreSQL\10\data\postgresql.conf

 

 设置:listen_addresses = '*'

           ssl = off

           port = 5432

           superuser_reserved_connections = 3

 

6.2 notepad D:\Program Files\PostgreSQL\10\data\pg_hba.conf

 

 设置ipv4段

host    all             all             0.0.0.0/0            md5

 

七、启动服务

 

net start PostgreSQL

 

##E:/PostgreSQL/10/bin/pg_ctl -D "E:\PostgreSQL\10\data" -l logfile start

 

 

总结:上面标红的地方请特别注意,若是这些网络相关的设置没有设置对,则链接不上数据库。

相关文章
相关标签/搜索