mysql数据源url参数

jdbc:mysql://[host:port]/[database][?参数名1][=参数值1][&参数名2][=参数值2]…

参数名参数类型参数详解
useUnicodeString是否使用Unicode字符集,如果参数characterEncoding设置为gb2312或gbk,本参数值必须设置为true
characterEncodingString当useUnicode设置为true时,指定字符编码。比如可设置为utf-8
autoReconnectboolean当数据库连接异常中断时,是否自动重新连接
autoReconnectForPoolsboolean是否使用针对数据库连接池的重连策略
maxReconnectsintautoReconnect设置为true时,重试连接的次数
failOverReadOnlyboolean自动重连成功后,连接是否设置为只读
serverTimezoneString设置数据库时区,UTC:为统一标准世界时间,比北京时间晚8小时; GMT%2B8:北京时间东八区;Asia/Shanghai:上海时间
useSSLboolean是否进行SSL连接 高版本设置useSSL=true,不然会有警告信息
allowMultiQueriesboolean允许批量更新,默认false,在批量更新时会报错
verifyServerCertificateboolean设置SSL连接后是否验证服务器证书

记录问题:

  1. 连接数据库后报警告

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

解决:在URL中添加参数useSSL=trueuseSSL=false

  1. 设置URL中添加参数useSSL=true后,连接不上数据库

解决:在useSSL=true后添加参数verifyServerCertificate=false useSSL=true&verifyServerCertificate=false

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值