IDEA在运行时报错:You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
看错误意思:
CST 2022 WARN:不建议在没有服务器身份验证的情况下建立SSL连接。 根据MySQL 5.5.45+、5.6.26+和5.7.6+的要求,如果没有设置显式选项,默认必须建立SSL连接。 为了符合不使用SSL的现有应用程序,verifyServerCertificate属性被设置为’false’。 您需要通过设置useSSL=false显式禁用SSL,或者设置useSSL=true并为服务器证书验证提供信任存储区。
解决:
找到数据库和项目连接的配置文件
application-prod.properties:
spring.datasource.url=jdbc:mysql://localhost:3306/demo20230621?serverTimezone=UTC&characterEncoding=utf8&useUnicode=true&useSSL=false
重点:useSSL=false 同时保证IDEA MySQL版本和本地或者远端的mysql 数据库版本一致