目录

报错信息

Wed Mar 13 17:08:37 CST 2019 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.
 
1:admin

连接mysql报错——没有设置“usessl=false”的问题

解决办法            

在配置数据库的URL时,加上usessl=false就可以了。

添加前

连接mysql报错——没有设置“usessl=false”的问题

连接mysql报错——没有设置“usessl=false”的问题

添加后

连接mysql报错——没有设置“usessl=false”的问题

连接mysql报错——没有设置“usessl=false”的问题

附上Configuration.xml代码

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
    <!-- mybatis别名定义 -->
    <typeAliases> 
        <typeAlias alias="User" type="com.mybatis.test.User"/> 
    </typeAliases> 
 
    <environments default="development">
        <environment id="development">
        <transactionManager type="JDBC"/>
            <dataSource type="POOLED">
            <property name="driver" value="com.mysql.jdbc.Driver"/>
            <property name="url" value="jdbc:mysql://19****:3306/***?useSSL=false" />
            <property name="username" value="***"/>
            <property name="password" value="***"/>
            </dataSource>
        </environment>
    </environments>
    
    <!-- mybatis的mapper文件,每个xml配置文件对应一个接口 -->
    <mappers>
        <mapper resource="com/mybatis/test/User.xml"/>
    </mappers>
</configuration>

以上为个人经验,希望能给大家一个参考,也希望大家多多支持。

觉得上面的内容有用吗?快来点个赞吧!

点赞() 我要打赏

温馨提示 : 本站内容来自会员投稿以及互联网,所有源码及教程均为作者总结编辑,请大家在使用过程中提前做好备份,以免发生无法预知的错误,源码类教程请勿直接用于生产环境!

 可能感兴趣的文章