MySQL8.0数据库连接驱动问题

如果你不需要使用SSL连接,你需要通过设置useSSL=false来显式禁用SSL连接。如果你需要用SSL连接,就要为服务器证书验证提供信任库,并设置useSSL=true SSL – Secure Sockets Layer(安全套接层)MySQL8.0数据库连接驱动问题 标签:runtimeESSauthattcomhand配置6.2mysqli 标签 runtime ESS auth att co...
MySQL8.0数据库连接驱动问题
dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <--<scope>runtime</scope>--> <version>8.0.11</version></dependency>
另外,application.properties文件中的数据库配置项也需要相应变化:
spring.datasource.url=jdbc:mysql://localhost:3306/toutiao?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8spring.datasource.username=rootspring.datasource.password=789456123spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
url 需要添加时区设置:
&serverTimezone=GMT%2B8 (GMT%2B8代表东八区)
也可设置为:serverTimezone=UTC serverTimezone=Shanghai(会比中国时间早8个小时,如果在中国,可以选择Asia/Shanghai或者Asia/Hongkong)
如果mysql-connector-java用的6.0以上的
如果MySQL-connector-java用的6.0以上的,则driver要使用:
com.mysql.cj.jdbc.Driver
如果未明确设置,MySQL 5.5.45+, 5.6.26+ and 5.7.6+版本默认要求建立SSL连接。
为了符合当前不使用SSL连接的应用程序,verifyServerCertificate属性设置为’false’
如果你不需要使用SSL连接,你需要通过设置useSSL=false来显式禁用SSL连接。
如果你需要用SSL连接,就要为服务器证书验证提供信任库,并设置useSSL=true
SSL – Secure Sockets Layer(安全套接层)
MySQL8.0数据库连接驱动问题
标签:runtimeESSauthattcomhand配置6.2mysqli
标签 runtime ESS auth att com hand 配置 6.2 mysqli2024-07-22
mengvlog 阅读 48 次 更新于 2025-10-30 12:59:38 我来答关注问题0
檬味博客在线解答立即免费咨询

mySQL相关话题

Copyright © 2023 WWW.MENGVLOG.COM - 檬味博客
返回顶部