签到成功

知道了

CNDBA社区CNDBA社区

JDBC连接MySQL时日志出现警告WARN: Establishing SSL connection without server's identity verification is not recommended

2018-07-19 18:14 2983 0 原创 Mysql
作者: Expect-乐

1.tomcat日志错误信息

Thu Jul 19 18:01:03 CST 2018 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.

2.解决方法

根据日志信息可以知道,需要在JDBC连接串中配置useSSL=false,如下:http://www.cndba.cn/Expect-le/article/2902

http://www.cndba.cn/Expect-le/article/2902

<bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="com.mysql.jdbc.Driver" />
    <property name="url" value="jdbc:mysql://localhost:3306/databasename?characterEncoding=utf8&amp;useSSL=false" />
    <property name="username" value="test" />
    <property name="password" value="test" />
</bean>

重启TOMCAT即可。

http://www.cndba.cn/Expect-le/article/2902
http://www.cndba.cn/Expect-le/article/2902
http://www.cndba.cn/Expect-le/article/2902
http://www.cndba.cn/Expect-le/article/2902http://www.cndba.cn/Expect-le/article/2902http://www.cndba.cn/Expect-le/article/2902http://www.cndba.cn/Expect-le/article/2902
http://www.cndba.cn/Expect-le/article/2902

版权声明:本文为博主原创文章,未经博主允许不得转载。

useSSL=false

用户评论
* 以下用户言论只代表其个人观点,不代表CNDBA社区的观点或立场
Expect-乐

Expect-乐

关注

Without the continuous bitter cold, there can be no fragrant plum blossom

  • 336
    原创
  • 6
    翻译
  • 100
    转载
  • 41
    评论
  • 访问:1547839次
  • 积分:1957
  • 等级:核心会员
  • 排名:第4名
精华文章
    最新问题
    查看更多+
    热门文章
      热门用户
      推荐用户
        Copyright © 2016 All Rights Reserved. Powered by CNDBA · 皖ICP备2022006297号-1·

        QQ交流群

        注册联系QQ