나만무 준비기간 5일차 - 스프링 MySQL 연결

김명석·2025년 6월 17일

나만무

목록 보기
5/39
post-thumbnail

MySQL - Spring 연결법

application.properties

spring.application.name=board

#MySQL ??
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

# DB Source URL
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/practiceboard?allowPublicKeyRetrieval=true&useSSL=false&useUnicode=true&serverTimezone=Asia/Seoul

# DB username
spring.datasource.username=practiceboardadmin

# DB password
spring.datasource.password=dc24041424@

# true
spring.jpa.show-sql=true

# DDL(create, alter, drop)
spring.jpa.hibernate.ddl-auto=update

# JPA
spring.jpa.properties.hibernate.format_sql=true

# Port
server.port=8081

ModelAttribute 어노테이션으로 json처럼 담아서 데이터 보내기 가능

ddl-auto entity를 처음 실행할때 자동으로 테이블을 만들지 말지 설정하는 코드 none이면 아무것도 하지않는다.

profile
응애

0개의 댓글