Spring Cloud+Hibernate 连接MySQL8.0的配置

方式一

spring.datasource.url=jdbc:mysql://localhost/clientdb?serverTimezone=UTC
spring.datasource.username=testuser
spring.datasource.password=test
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
spring.jpa.properties.hibernate.hbm2ddl.auto=validate

方式二

spring.datasource.url=jdbc:mysql://localhost:3306/clientdb?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
spring.datasource.username=testuser
spring.datasource.password=test
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
spring.jpa.properties.hibernate.hbm2ddl.auto=validate

注意:如果网络连接是公司AD域,则必须用计算名称替代localhost。

猜你喜欢

转载自blog.csdn.net/chenxianping/article/details/102942541
今日推荐