Mysql5.5以上版本出现SSL警告问题的解决方案

背景:

        在使用SpringBoot1.x版本的时候出现Mysql出现异常,出现SSL没有得到服务的连接认证。(在SpringBoot2.x版本中暂时没有发现该问题)

2020-07-22 14:35:10.711  INFO 18480 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 54 ms
要查询的用户Id为:2
Wed Jul 22 14:35:10 CST 2020 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Wed Jul 22 14:35:11 CST 2020 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate 

解决方案:

步骤:

1. 首先就是Mysql的数据库配置:

之前使用:地址+端口号+数据库的名称

spring:
  datasource:
    url: jdbc:mysql://192.168.59.129:3306/Jpa
    username: root
    password: 123456
    driver-class-name: com.mysql.jdbc.Driver

这种情况在每次使用数据库都会有异常警告,所以我们进行配置如下:

spring:
  datasource:
    url: jdbc:mysql://192.168.59.129:3306/Jpa?useUnicode=true&characterEncoding=utf-8&useSSL=false
    username: root
    password: 123456
    driver-class-name: com.mysql.jdbc.Driver

 加上上面的配置就可以正常使用了。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值