Linux安裝 PostgreSQL


1、在線安裝

yum install postgresql-server -y

2、初始化數據庫

service postgresql initdb

3、設置自動啟動

hkconfig postgresql on

4、啟動
service postgresql start

如何修改默認密碼

su - postgres
psql
alter user postgres with password 'newpassword';

修改后重啟服務

service postgresql restart或者
/bin/systemctl restart postgresql.service

測試登陸

psql -h 127.0.0.1 -p 5432 -U postgres

設置所有網絡都可以訪問(默認是本機)

cd /var/lib/pgsql/data/
vim postgresql.conf
listen_addresses = '*'

設置認證模式,在pg_hba.conf文件中增加

host    all             all             0.0.0.0/0               password


免責聲明!

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



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