前言
许久未维护的项目需要检查一些数据,重新运行项目发现有create connection SQLException ,具体报错信息是 errorCode 0, state 08S01 。

SpringBoot 版本2.5,MySQL 8.0

报错详情
2021-12-18 22:47:14.834 ERROR 20196 --- [reate-940563698] com.alibaba.druid.pool.DruidDataSource : create connection SQLException, url: jdbc:mysql://localhost:3306/renrenfast?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai, errorCode 0, state 08S01

com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:827)
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:447)
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:237)
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199)
at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:156)
at com.alibaba.druid.filter.FilterAdapter.connection_connect(FilterAdapter.java:786)
at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:150)
at com.alibaba.druid.filter.stat.StatFilter.connection_connect(StatFilter.java:218)
at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:150)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1572)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1636)
at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2550)
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)
at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)
at com.mysql.cj.protocol.a.NativeProtocol.negotiateSSLConnection(NativeProtocol.java:340)
at com.mysql.cj.protocol.a.NativeAuthenticationProvider.negotiateSSLConnection(NativeAuthenticationProvider.java:777)
at com.mysql.cj.protocol.a.NativeAuthenticationProvider.proceedHandshakeWithPluggableAuthentication(NativeAuthenticationProvider.java:486)
at com.mysql.cj.protocol.a.NativeAuthenticationProvider.connect(NativeAuthenticationProvider.java:202)
at com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1348)
at com.mysql.cj.NativeSession.connect(NativeSession.java:163)
at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:947)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:817)
... 11 common frames omitted
Caused by: javax.net.ssl.SSLHandshakeException: Invalid Alert message: no sufficient data
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:131)
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:117)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:336)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:292)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:283)
at java.base/sun.security.ssl.Alert$AlertMessage.<init>(Alert.java:196)
at java.base/sun.security.ssl.Alert$AlertConsumer.consume(Alert.java:236)
at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:185)
at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:171)
at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1408)
at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1314)
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:440)
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:411)
at com.mysql.cj.protocol.ExportControlled.performTlsHandshake(ExportControlled.java:316)
at com.mysql.cj.protocol.StandardSocketFactory.performTlsHandshake(StandardSocketFactory.java:188)
at com.mysql.cj.protocol.a.NativeSocketConnection.performTlsHandshake(NativeSocketConnection.java:99)
at com.mysql.cj.protocol.a.NativeProtocol.negotiateSSLConnection(NativeProtocol.java:331)
... 18 common frames omitted

配置详情
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
druid:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/xxx?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai

解决方案
只需要加上&useSSL=false

spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
druid:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/xxx?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false

效果检测
真的运行起来了!看来

Moshow郑锴
关注

springboot连接mysql报错errorCode 0, state 08S01的更多相关文章

  1. springboot连接mysql报错:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException

    nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. ...

  2. PHP连接MySQL报错:SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket 'MySQL' (2)

    如下所示,PHP连接MySQL报错: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket 'MySQL' ...

  3. Navicat连接Mysql报错:Client does not support authentication protocol requested by server;

    Navicat连接Mysql报错:Client does not support authentication protocol requested by server: 刚安装Mysql,想用Nav ...

  4. Asp.Net连接Mysql报错Out of sync with server

    Asp.Net连接Mysql报错Out of sync with server 原因:程序引用的MySql.Data.dll版本高于服务器版本 解决:下载一个低版本的MySql.Data.dll,项目 ...

  5. Navicat连接mysql报错1251 -client does not support authentication protocol

    原文https://blog.csdn.net/qq_35654080/article/details/82588188 详解请参考https://blog.csdn.net/chszs/articl ...

  6. 用Navicat for mysql连接mysql报错1251-解决办法

    今天下了个 MySQL8.0,发现Navicat连接不上,总是报错1251: 原因是MySQL8.0版本的加密方式和MySQL5.0的不一样,连接会报错. 试了很多种方法,终于找到一种可以实现的: 更 ...

  7. navicat连接mysql报错1251解决方案

    感谢原文作者:XDMFC 原文链接:https://blog.csdn.net/xdmfc/article/details/80263215 问题描述 今天下了个 MySQL8.0,发现Navicat ...

  8. 2013 - lost connection to mysql server at 'reading initial communication packet' 连接mysql报错

    早上刚到公司,启动项目发现连接池初始化报错,于是我打开本地mysql管理工具,测试是否可以连接.报错2013代码: 现已解决. 重启服务器mysql服务就好. 因为我连接的是本地windows系统,所 ...

  9. springboot启动提示连接mysql报错:java.sql.SQLNonTransientConnectionException: CLIENT_PLUGIN_AUTH is required

    如题,启动springboot报错: -- :: --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized wi ...

  10. pycharm pymysql连接mysql 报错 pymysql.err.InterfaceError: (0, '')

    pycharm  pymysql连接mysql  执行MySQL操作遇到以下报错信息: conn.query(q) File "C:\Software\Python37\lib\site-p ...

随机推荐

  1. MobileNet V2中InvertedResidual实现

    1.为了方便理解其本身结构,找到源码理解一下. 2.论文地址:http://arxiv.org/pdf/1801.04381.pdf 3.V2相比较V1增加了倒残差结构和线性瓶颈层.整个结构按照维度来 ...

  2. Java日期时间API系列41-----根据毫秒值计算倒计时

    会有一个比较常见的需求,计算倒计时,比如,计算距离某时间剩余时间(27小时10分钟30秒.1天3小时10分钟30秒)或者已经进行了多长时间等.下面是2种实现代码:其中第一种超过1天会体现在小时上,比如 ...

  3. Linux基础-学会使用命令帮助

    概述 使用 whatis 使用 man 查看命令程序路径 which 总结 参考资料 概述 Linux 命令及其参数繁多,大多数人都是无法记住全部功能和具体参数意思的.在 linux 终端,面对命令不 ...

  4. 【VMware VCF】使用 Offline Bundle Transfer Utility(OBTU)配置 VCF 脱机库。

    VMware Cloud Foundation 环境中,软件包仓库的来源支持两种方式,分别是 Online Depot 和 Offline Depot.第一种方式,是在 VCF 环境能够连接互联网的情 ...

  5. 题解:CSP-S2020] 函数调用

    题解:CSP-S2020] 函数调用 一句话题意:给定一个有初始值的序列,支持如下三种操作: 1.单点加 2.全局乘 3.递归某些操作1.2.3 求最终的序列. 标签:topsort,动态规划,转化贡 ...

  6. ubuntu20.04手动换源——个人向

    备份你的源,然后替换你的 Linux 主机上 /etc/apt/source.list 即可. 笔者用的源如下: 点击查看代码 # deb cdrom:[Ubuntu 20.04.4 LTS _Foc ...

  7. cmu15545-索引并发控制(Concurrent Indexes)

    目录 Overview Lock和Latch辨析 设计目标 大致分类 Hash Table Latches Page Latches Slot Latches B+Tree Latches 并发问题 ...

  8. 2024-2025, 四大翻译工具加AI翻译的深度对比

    前言 在过去两年中,人工智能技术的迅猛发展对翻译工具产生了深远的影响. 本期特意挑选了四款翻译工具以及一个AI翻译工具, 对其性能进行评测,看看在AI技术的加持下,它们的质量提升如何. 以下是参赛选手 ...

  9. 微信小程序原生AI运动(动作)检测识别解决方案

    前几年受疫情影响,人员流动受限,反而让"AI运动"概念风靡一时.空前火爆.目前已经在AI运动锻炼.体育教学.线上运动主题活动等场景中,成功得到了应用,并获得了广大互联网用户的认可. ...

  10. 腾讯云 AI 代码助手:产品研发过程的思考和方法论

    文章摘要 本文将详细阐述 腾讯云 AI 代码助手的历史发展形态与产品整体架构,并从技术.研发方法论的角度分别阐述了产品的研发过程. 全文阅读约 5-8 分钟. 产品布局 AI 代码助手产品经历了三个时 ...