您好,登錄后才能下訂單哦!
https://www.postgresql.org/download/linux/redhat/
2、開始安裝
yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm -y
yum install postgresql12 -y
yum install postgresql12-server -y
/usr/pgsql-12/bin/postgresql-12-setup initdb
systemctl enable postgresql-12
systemctl start postgresql-12
這一步初始化數(shù)據(jù)庫命令會在 /var/lib/pgsql 目錄下創(chuàng)建名稱為12文件夾,12為數(shù)據(jù)庫版本。這里如果已經(jīng)有對應(yīng)版本的文件夾了,初始化這一步會報錯,需要你自行去刪除對應(yīng)的文件夾再去初始化。
修改:#listen_addresses = 'localhost'為listen_addresses = '*'
修改前
修改后
并重新啟動
systemctl restart postgresql-12
su postgres #不能使用root用戶登錄,切換到普通用戶
psql -U postgres
\password #設(shè)置用戶密碼
select version(); #查看版本
免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。