用useSSL=true或useSSL=false无法解决WARN: Establishing SSL connection without server‘s identity verificatio

用useSSL=true或useSSL=false无法解决WARN: Establishing SSL connection without server’s identity verification is not recommended. …报错的解决方法(自用)

问题描述:

在b站自学mybatis,明明和视频操作一样但是报了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.的错,百度了半个多小时解决方法基本都是在url加上useSSL=true或useSSL=false,但是我的就是没有用,后面就抱着试试看的心态重新建了一个项目,所有的内容都粘贴复制了一遍,因为之前上课跟着专业老师学的时候也连接了数据库,没有加useSSL也没有报错,但是选择的MySQL版本不一样,想着可能是这里的问题,就把它改了
在这里插入图片描述
在这里插入图片描述
这次运行终于没有报那个错了!!!!但是又报了另外一个错,Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.
然后查到的解决方法是引入的mysql-connector-java依赖版本和mysql版本要一致(查自此文章
在这里插入图片描述
之前依赖版本
在这里插入图片描述修改后依赖版本在这里插入图片描述
修改完后记得修改配置文件中的driver
修改为com.mysql.cj.jdbc.Driver
再次运行,成功!
后面又想了想,之前那个项目报错解决不了会不会也是因为版本不一致的原因,于是又返回旧项目中将依赖版本修改了一下,也同样运行成功了

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值