您当前的位置: 首页 >  ui

小志的博客

暂无认证

  • 0浏览

    0关注

    1217博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

com.alibaba.druid.pool.DruidDataSource : {dataSource-1} inited

小志的博客 发布时间:2020-04-23 09:10:08 ,浏览量:0

1、报错如下:

在这里插入图片描述

2020-04-22 21:27:46.931  INFO 11468 --- [ MQTT Call: aaa] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} inited

Wed Apr 22 21:27:46 CST 2020 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、报错原因是MySQL在高版本需要指明是否进行SSL连接:

在这里插入图片描述

3、解决方式:

1)、在配置的数据源url后追加如下属性,问题解决。

?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone =Asia/Shanghai

2)、旧的数据源配置如下:

spring:
  datasource:
    #   数据源基本配置
    username: 123456
    password: 123456
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://localhost:3306/restful_crud
    type: com.alibaba.druid.pool.DruidDataSource

3)修改后的数据源配置如下:

spring:
  datasource:
    #   数据源基本配置
    username: 123456
    password: 123456
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://localhost:3306/restful_crud?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone =Asia/Shanghai
    type: com.alibaba.druid.pool.DruidDataSource
4、常用的Mysql JDBC Url参数说明 参数名称参数说明useUnicode是否使用Unicode字符集,如果参数characterEncoding设置为gb2312或gbk,本参数值必须设置为truecharacterEncoding当useUnicode设置为true时,指定字符编码。比如可设置为gb2312或gbkuseSSL是否进行SSL连接serverTimezone设置时区时间
关注
打赏
1661269038
查看更多评论
立即登录/注册

微信扫码登录

0.0443s