Windows Server 2012 R2 上安裝PostgreSQL 13


第一步 安裝Windows Server 2012 升級補丁

按照順序安裝

  • Windows8.1-KB2939087-x64.msu
  • Windows8.1-KB2975061-x64.msu
  • Windows8.1-KB2919355-x64.msu
  • Windows8.1-KB2999226-x64.msu

第二步 安裝MicroSoft VC++ 2015-2019 Redistributable 環境

第三步 安裝postgresql-13.2-1-windows-x64

第四步 在服務器上創建非管理員賬號(注意命令行用管理員身份)

執行命令 net user postgres password /add 創建postgres賬號
執行命令 runas /user:postgres cmd.exe 以postgres賬號運行cmd窗口

第五步 以管理員賬號注冊postgres服務


initdb.exe -D "D:\Program Files\PostgreSQL\13\data" -E UTF-8 --locale=chs -U postgres -W

第六步 初始化數據庫及服務啟動

  • 以系統管理員運行命令 initdb.exe -D "D:/PostgreSQL/13/data" -E UTF-8 --locale=chs -U postgres -W


     
    初始化數據
  • 設置系統環境變量PGDATA


     
    系統環境變量
  • 以系統管理員運行命令運行 pg_ctl.exe start 啟動服務


     
    啟動服務

第七步 允許遠程訪問postgresql

  • 找到postgresql.conf文件,注意安裝路徑
    D:\Program Files (x86)\PostgreSQL\9.3\data
  • 打開該文件,注意以下內容,確認為下面內容后,進行下一步
    listen_addresses = '*'
  • 打開pg_hba.conf文件,注意以下內容
    host all all 0.0.0.0/32 trust
  • 在Windows的服務中重新啟動postgre服務

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM