windows安装使用PostgreSQL
最近一个项目要用到pgsql的自定义函数,在windows上安装一个。
下载的是12的版本,
https://get.enterprisedb.com/postgresql/postgresql-12.13-1-windows-x64.exe
刚开始安装后出现问题,看到是杀毒软件影响到了。关闭杀毒软件,重新卸载安装。
为了使用方便,把pg库的bin目录添加到环境变量。
由于是开发,为了使用方便,
修改pg库data目录的pg_hba.conf,把md5修改为trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust
启动服务器:
在命令行启动
pg_ctl.exe reload -N “postgres_12” -D “D:\Program Files\PostgreSQL\12\data”
psql -h 127.0.0.1 -U postgres