Hibernate:数据库连接的配置

SpringBoot连接mysql需要在application.properties添加一些微调信息,Spring自带连接池,如果用Spring自带的连接池:

spring.datasource.url=jdbc:mysql://localhost:3306/jelly?useSSL=false&characterEncoding=utf8
spring.datasource.username=tom
spring
.datasource.password=123456
spring
.datasource.driver-class-name=com.mysql.jdbc.Driver

 然后配置Hibernate

# Specify the DBMS
spring.jpa.database=MYSQL
# Show or not log for each sql query
spring.jpa.show-sql=true
# Hibernate ddl auto (create, create-drop, update)
spring.jpa.hibernate.ddl-auto=update
# Naming strategy
spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
# stripped before adding them to the entity manager)
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
原文地址:https://www.cnblogs.com/colin220/p/9595524.html