728x90
반응형
SpringBoot Project
1. build.gradle
runtimeOnly 'org.postgresql:postgresql'
2. application.yml
spring:
# Postgres Database
datasource:
url: jdbc:postgresql://localhost:5432/devplan
username: plan
password: plan
driver-class-name: org.postgresql.Driver
# JPA
jpa:
hibernate:
ddl-auto: create # 자동으로 테이블 생성 (drop -> create)
properties:
hibernate:
format_sql: true
Mac 터미널로 Postgresql 설치
1) 터미널에서 postgresql 설치
brew install postgresql
2) postgresql start
brew services start postgresql
3) 설치한 postgres 버전 확인
postgres -V
4) 최초 계정(postgres) 접속
psql postgres
5) database 생성
create database 데이터베이스명;
6) user 생성
create user 아이디 with encrypted password '비밀번호';
7) 생성한 user에 database 권한 부여
grant all privileges on database 데이터베이스명 to 아이디;
8) postgresql stop
brew services stop postgresql
반응형