建置PostgreSQL ``` sudo yum install --disablerepo=nexus-repo epel-release ``` 添加PostgreSQL ``` sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm ``` 安装PostgreSQL ``` sudo yum install -y --disablerepo=nexus-repo postgresql12 postgresql12-server ``` 初始化資料庫並啟動PostgreSQL ``` sudo service postgresql initdb sudo systemctl start postgresql ``` 切換使用者 ``` sudo -u postgres psql ``` 創建db ``` CREATE DATABASE nexus; ``` 替換密碼 ``` CREATE USER nexus_user WITH ENCRYPTED PASSWORD 'your_password'; ``` 賦予權限 ``` GRANT ALL PRIVILEGES ON DATABASE nexus TO nexus_user; ``` 離開 ``` \q ``` 連線db nexus ``` psql -h 127.0.0.1 -U nexus -d nexus -W ``` 如遇 ``` psql: error: FATAL: Ident authentication failed for user "nexus" ``` 使用 ``` sudo nano /var/lib/pgsql/12/data/pg_hba.conf ``` 進去修改pg_hba.conf  將nexus加在最上面 ``` host nexus nexus 127.0.0.1/32 md5 ``` 重新嘗試連接 ``` psql -h 127.0.0.1 -U nexus -d nexus -W ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up