linux下postgreSQL初始化設置方法


1.首先創建postgres用戶

useradd -m postgres
passwd postgres
2.創建數據庫工作目錄
mkdir /opt/postgres/data
chown -R postgres /opt/postgres/data
3.切換到postgres用戶,開始初始化數據庫
  1.  su - postgres
  2.  initdb -D /opt/postgres/ data
4.允許所有主機訪問postgreSQL
vim  /opt/postgres/data/postgresql.conf
修改其中的我# listen_addresses = 'localhost'為 listen_addresses = '*'
vim pg_hba.conf

增加一條:

host    all             all              0.0.0.0/0              md5

5.啟動數據庫

啟動數據庫:

postgres -D /opt/postgres/data
日志:  數據庫上次關閉時間為 2013-03-22 23:14:19 CST
日志:  數據庫系統准備接受連接
日志:  已啟動autovacuum
 

轉載於:https://my.oschina.net/dddpeter/blog/116148


免責聲明!

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



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