官网下载地址:
https://www.enterprisedb.com/downloads/postgres-postgresql-downloads
Windows平台
官网直接提供exe安装包,没有手动安装的压缩包
postgresql-14.4-1-windows-x64.exe
几个重要的安装选项
-
安装界面会指定服务程序和库两个路径,可以自己手动选择
-
指定默认账户的密码
-
选择额外的安装项(这里我选了一个JDBC驱动包,方便DBeaver访问)
记录一下
Installation Directory: E:\Program Files\PostgreSQL\16
Server Installation Directory: E:\Program Files\PostgreSQL\16
Data Directory: E:\Program Files\PostgreSQL\16\data
Database Port: 6666
Database Superuser: postgres
Operating System Account: NT AUTHORITY\NetworkService
Database Service: postgresql-x64-16
Command Line Tools Installation Directory: E:\Program Files\PostgreSQL\16
pgAdmin4 Installation Directory: E:\Program Files\PostgreSQL\16\pgAdmin 4
Stack Builder Installation Directory: E:\Program Files\PostgreSQL\16
Installation Log: C:\Users\sumnit\AppData\Local\Temp\install-postgresql.log
上述安装完成之后,使用navicat进行连接访问,发现身份验证失败:
修改办法:
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all trust
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust
重新登录:
修改:
使用navicat进行连接访问,发现乱码:
参考这篇文章,发现是配置在DB目录的配置
https://blog.csdn.net/m0_59322443/article/details/122967482
IPv4 local connections:
host all all 0.0.0.0/0 trust
解决办法:
https://blog.csdn.net/m0_46833693/article/details/131512468
https://blog.csdn.net/weixin_52799373/article/details/139283982
https://blog.csdn.net/asp_netMiss/article/details/137874461
https://zhuanlan.zhihu.com/p/700394365