s00jin 님의 블로그

1. [MySQL/SpringBoot] 로컬 MySQL 연결하기 본문

프로젝트/하고 싶은거 다해보는 내 사이트

1. [MySQL/SpringBoot] 로컬 MySQL 연결하기

s00jin 2025. 6. 26. 12:11

1. 로컬 MySQL 데이터베이스 생성

로컬 MySQL에 데이터베이스를 먼저 만들고, 연결을 진행한다.

 

2. application.properties

spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/[database명]
serverTimezone=Asia/Seoul
spring.datasource.username=[username]
spring.datasource.password=[password]

spring.jpa.properties.hibernate.show_sql=true
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.hibernate.ddl-auto=create

spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect

 

3. build.gradle에 추가

    // mysql
    implementation 'mysql:mysql-connector-java:8.0.32'

 

위 코드를 추가해주고 새로고침 해준다.