①postgresql.confの変更 ※IPアドレスの変更とポートの開放
vi /var/lib/pgsql/data/postgresql.conf
listen_address = 'localhost'
posrt = 5432
②postgresql.service ※起動スクリプトでポート番号を確認
vi /usr/lib/systemd/system/postgresql.service
Enviroment=PGPORT=5432
③pg_hba.confの変更 ※接続する際の認証を設定するファイル
vi /var/lib/pgsql/data/pg_hba.conf
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
[Spring Boot]
①application.yml
spring:
datasource:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://localhost:5432/db名
username: postgres
password: postgres
ミドルウェアの起動順
systemctl start postgresql.service
systemctl start tomcat.service
systemctl start httpd.service