MySql과 스프링부트 DB 연동
스프링부트 프로젝트 안에 src 폴더 -> build.gradle 더블클릭
dependencies 안에 JPA 넣어주기
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
src/main/resources -> application.properties 더블클릭
아래문구 넣어주고 수정 부분 수정해주기
spring.datasource.dbcp2.driver-class-name=com.mysql.cj.jdbc.Driverm.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/DB명?characterEncoding=utf8
spring.datasource.username=계정명
spring.datasource.password=비밀번호
yml 형식으로 작성할 경우
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/DB명?characterEncoding=utf8
username: 계정명
password: 비밀번호
//JPA 등등 나머지 관련 설정
jpa:
hibernate:
naming:
implicit-strategy: org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl