其他分享
首页 > 其他分享> > Communications link failure The last packet sent successfully to the server was 0 milliseconds ago.

Communications link failure The last packet sent successfully to the server was 0 milliseconds ago.

作者:互联网

mysql数据库是5.7版本

数据库的包是8.0.17

最开始的url:

    url: jdbc:mysql://localhost:3306/xxx?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai

根据报错原因以为是数据库连接池的问题,后来加入了数据库连接池,还是报错,最后加入了这个&useSSL=false,不报错了

# spring配置
spring:
  application:
    name: webmagic
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/xxx?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
    username: root
    password: 123456
    druid:
      stat-view-servlet:
        enabled: true
        url-pattern: /druid/*
        loginUsername: admin
        loginPassword: 123456
    #   数据源其他配置
    initialSize: 5
    minIdle: 5
    maxActive: 20
    maxWait: 60000
    timeBetweenEvictionRunsMillis: 60000
    minEvictableIdleTimeMillis: 300000
    validationQuery: SELECT 1 FROM DUAL
    testWhileIdle: true
    testOnBorrow: false
    testOnReturn: false
    poolPreparedStatements: true
    #配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
    filters: stat,wall
    maxPoolPreparedStatementPerConnectionSize: 20
    useGlobalDataSourceStat: true
    connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500
 <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid-spring-boot-starter</artifactId>
            <version>1.1.17</version>
        </dependency>

标签:ago,...,stat,last,url,druid,mysql,false,true
来源: https://www.cnblogs.com/q1359720840/p/16611536.html