Spring Data JPA – Mysql Configuration

While we are developing our application, we always need to have database connection information. Here is a quick copy/paste reference for Mysql Connection with Spring Boot framework. Just place following code to application.properties file and let the application run.

spring.datasource.url=jdbc:mysql://localhost:3306/spring?useUnicode=yes&characterEncoding=UTF-8
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
spring.datasource.username=spring
spring.datasource.password=spring

spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update

Here you can find the maven dependency for Mysql.

<dependency>
  <groupId>mysql</groupId>
  <artifactId>mysql-connector-java</artifactId>
  <scope>runtime</scope>
</dependency>

Enjoy..