🔻Back-End/Spring
[Spring] MySQL, MariaDB, H2 DB 연결하는 application.yml 설정
_니지
2023. 1. 7. 20:40
프로젝트와 DB를 연결할 때 yml에서 어떤 DB를 쓸 것인지 명시해주어야 한다
각 DB에 따라서 드라이버 이름과 url이 다르기 때문에 나누어 작성해두었다!
❗MySQL
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/[스키마이름]
username: root
password: 12341234
❗MariaDB
spring:
datasource:
driver-class-name: org.mariadb.jdbc.Driver
url: jdbc:mariadb://localhost:3307/[스키마이름]
username: root
password: 12341234
❗H2
spring:
h2:
console:
enabled: true
path: /h2-console
datasource:
driver-class-name: org.h2.Driver
url: jdbc:h2:mem:testdb
username: sa
password:
728x90
반응형