You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true

遇到一个问题
在这里插入图片描述
关键点:
You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

翻译一下:
CST 2022 WARN:不建议在没有服务器身份验证的情况下建立SSL连接。 根据MySQL 5.5.45+、5.6.26+和5.7.6+的要求,如果没有设置显式选项,默认必须建立SSL连接。 为了符合不使用SSL的现有应用程序,verifyServerCertificate属性被设置为’false’。 您需要通过设置useSSL=false显式禁用SSL,或者设置useSSL=true并为服务器证书验证提供信任存储区。

解决:
找到数据库和项目连接的配置文件
application-prod.properties

spring.datasource.url=jdbc:mysql://localhost:3306/life_vest?useUnicode=true&characterEncoding=UTF8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&useSSL=false

//原来:
//spring.datasource.url=jdbc:mysql://127.0.0.1:3306/life_vest?useUnicode=true&characterEncoding=utf-8

试错:
直接添加&useSSL=false,没有效果

spring.datasource.url=jdbc:mysql://127.0.0.1:3306/life_vest?useUnicode=true&characterEncoding=utf-8&useSSL=false
或者
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/life_vest?useSSL=false&useUnicode=true&characterEncoding=utf-8

查到的资料

第一种处理办法
jdbcUrl=jdbc:mysql://localhost:3306/zht?useUnicode=true&characterEncoding=utf-8&useSSL=false

1.先将mysql-connector-java的版本改到5.5.45之下
2.再将jdbcUrl改成如下

jdbcUrl=jdbc:mysql://localhost:3306/zht?useUnicode=true&characterEncoding=utf-8
第二种处理办法

如果你觉得更喜欢5.5.45以后的版本,那么需要将jdbc.properties里jdbcUrl换成新的:

jdbc:mysql://localhost:3306/zht?useUnicode=true&characterEncoding=UTF8&autoReconnect=true&zeroDateTimeBehavior=convertToNull

参数名称 | 参数说明
user | 数据库用户名(用于连接数据库)
password | 用户密码(用于连接数据库)
useUnicode | 是否使用Unicode字符集,如果参数characterEncoding | 设置为gb2312或gbk,本参数值必须设置为true
characterEncoding | 当useUnicode设置为true时,指定字符编码。比如可设置为gb2312或gbk
autoReconnect | 当数据库连接异常中断时,是否自动重新连接?
autoReconnectForPools | 是否使用针对数据库连接池的重连策略
failOverReadOnly | 自动重连成功后,连接是否设置为只读?
maxReconnects | autoReconnect设置为true时,重试连接的次数
initialTimeout | autoReconnect设置为true时,两次重连之间的时间间隔,单位:秒
connectTimeout | 和数据库服务器建立socket连接时的超时,单位:毫秒。 0表示永不超时,适用于JDK 1.4及更高版本
socketTimeout | socket操作(读写)超时,单位:毫秒。 0表示永不超时

附录:

完整application-prod.properties
阿里云 配置springboot与mysql数据库

spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/life_vest?useUnicode=true&characterEncoding=UTF8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&useSSL=false
//数据库名称
spring.datasource.username=root
//数据库密码
spring.datasource.password=
//指定启动连接池时,初始建立的连接数量
spring.datasource.initialSize=5  
//指定必须保持连接的最小值(For DBCP and Tomcat connection pools)
spring.datasource.minIdle=5 
//指定连接池中最大的活跃连接数.
spring.datasource.maxActive=20  
//指定连接池等待连接返回的最大等待时间,毫秒单位.
spring.datasource.maxWait=60000  
//指定空闲连接检查、废弃连接清理、空闲连接池大小调整之间的操作时间间隔
spring.datasource.timeBetweenEvictionRunsMillis=60000  
//指定一个空闲连接最少空闲多久后可被清除.
spring.datasource.minEvictableIdleTimeMillis=300000  
//指定获取连接时连接校验的sql查询语句.
spring.datasource.validationQuery=SELECT 1 FROM DUAL  
//当连接空闲时,是否执行连接测试.
spring.datasource.testWhileIdle=true  
//当从连接池借用连接时,是否测试该连接.
spring.datasource.testOnBorrow=false  
//在连接归还到连接池时是否测试该连接.
spring.datasource.testOnReturn=false  
//指定是否池化statements.
spring.datasource.poolPreparedStatements=true  
//
spring.datasource.maxPoolPreparedStatementPerConnectionSize=20  
//
spring.datasource.filters=stat,wall,log4j  
//在使用DBCP connection pool时指定要配置的属性
spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000

本地的话可以改成

jdbc:mysql://192.16.30.40:3306/life_vest

参考:
mysql 建立SSL连接问题,设置useSSL=false显式禁用SSL,或者设置useSSL=true

springboot配置mysql数据库spring.datasource.url报错的解决

  • 3
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Designing Software Product Lines with UML: From Use Cases to Pattern-Based Software Architectures 第二部分<br>Long a standard practice in traditional manufacturing, the concept of product lines is quickly earning recognition in the software industry. A software product line is a family of systems that shares a common set of core technical assets with preplanned extensions and variations to address the needs of specific customers or market segments. When skillfully implemented, a product line strategy can yield enormous gains in productivity, quality, and time-to-market. Studies indicate that if three or more systems with a degree of common functionality are to be developed, a product-line approach is significantly more cost-effective.<br><br>To model and design families of systems, the analysis and design concepts for single product systems need to be extended to support product lines. Designing Software Product Lines with UML shows how to employ the latest version of the industry-standard Unified Modeling Language (UML 2.0) to reuse software requirements and architectures rather than starting the development of each new system from scratch. Through real-world case studies, the book illustrates the fundamental concepts and technologies used in the design and implementation of software product lines.<br><br>This book describes a new UML-based software design method for product lines called PLUS (Product Line UML-based Software engineering). PLUS provides a set of concepts and techniques to extend UML-based design methods and processes for single systems in a new dimension to address software product lines. Using PLUS, the objective is to explicitly model the commonality and variability in a software product line.<br><br>Hassan Gomaa explores how each of the UML modeling views—use case, static, state machine, and interaction modeling—can be extended to address software product families. He also discusses how software architectural patterns can be used to develop a reusable component-based architecture for a product line and how to express this architecture as a UML platform-independent model that can then be mapped to a platform-specific model.<br><br>Key topics include:<br><br>Software product line engineering process, which extends the Unified Development Software Process to address software product lines<br><br>Use case modeling, including modeling the common and variable functionality of a product line<br><br>Incorporating feature modeling into UML for modeling common, optional, and alternative product line features<br><br>Static modeling, including modeling the boundary of the product line and information-intensive entity classes<br><br>Dynamic modeling, including using interaction modeling to address use-case variability<br><br>State machines for modeling state-dependent variability<br><br>Modeling class variability using inheritance and parameterization<br><br>Software architectural patterns for product lines<br><br>Component-based distributed design using the new UML 2.0 capability for modeling components, connectors, ports, and provided and required interfaces<br><br>Detailed case studies giving a step-by-step solution to real-world product line problems<br><br>Designing Software Product Lines with UML is an invaluable resource for all designers and developers in this growing field. The information, technology, and case studies presented here show how to harness the promise of software product lines and the practicality of the UML to take software design, quality, and efficiency to the next level. An enhanced online index allows readers to quickly and easily search the entire text for specific topics.<br>
Designing Software Product Lines with UML: From Use Cases to Pattern-Based Software Architectures 第一部分<br>Long a standard practice in traditional manufacturing, the concept of product lines is quickly earning recognition in the software industry. A software product line is a family of systems that shares a common set of core technical assets with preplanned extensions and variations to address the needs of specific customers or market segments. When skillfully implemented, a product line strategy can yield enormous gains in productivity, quality, and time-to-market. Studies indicate that if three or more systems with a degree of common functionality are to be developed, a product-line approach is significantly more cost-effective.<br><br>To model and design families of systems, the analysis and design concepts for single product systems need to be extended to support product lines. Designing Software Product Lines with UML shows how to employ the latest version of the industry-standard Unified Modeling Language (UML 2.0) to reuse software requirements and architectures rather than starting the development of each new system from scratch. Through real-world case studies, the book illustrates the fundamental concepts and technologies used in the design and implementation of software product lines.<br><br>This book describes a new UML-based software design method for product lines called PLUS (Product Line UML-based Software engineering). PLUS provides a set of concepts and techniques to extend UML-based design methods and processes for single systems in a new dimension to address software product lines. Using PLUS, the objective is to explicitly model the commonality and variability in a software product line.<br><br>Hassan Gomaa explores how each of the UML modeling views—use case, static, state machine, and interaction modeling—can be extended to address software product families. He also discusses how software architectural patterns can be used to develop a reusable component-based architecture for a product line and how to express this architecture as a UML platform-independent model that can then be mapped to a platform-specific model.<br><br>Key topics include:<br><br>Software product line engineering process, which extends the Unified Development Software Process to address software product lines<br><br>Use case modeling, including modeling the common and variable functionality of a product line<br><br>Incorporating feature modeling into UML for modeling common, optional, and alternative product line features<br><br>Static modeling, including modeling the boundary of the product line and information-intensive entity classes<br><br>Dynamic modeling, including using interaction modeling to address use-case variability<br><br>State machines for modeling state-dependent variability<br><br>Modeling class variability using inheritance and parameterization<br><br>Software architectural patterns for product lines<br><br>Component-based distributed design using the new UML 2.0 capability for modeling components, connectors, ports, and provided and required interfaces<br><br>Detailed case studies giving a step-by-step solution to real-world product line problems<br><br>Designing Software Product Lines with UML is an invaluable resource for all designers and developers in this growing field. The information, technology, and case studies presented here show how to harness the promise of software product lines and the practicality of the UML to take software design, quality, and efficiency to the next level. An enhanced online index allows readers to quickly and easily search the entire text for specific topics.<br>
环境: Eclipse Java EE IDE for Web Developers. Version: Oxygen.3a Release (4.7.3a) mysql-connector-java-8.0.11 MySQL Server 8.0 Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary. 驱动的类换了个名字 Class.forName("com.mysql.cj.jdbc.Driver"); Fri Jun 08 13:09:27 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. 加上useSSL=truefalse 参考地址 con = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/test?useSSL=true", "root", "123456"); java.sql.SQLException: The server time zone value '???ú±ê×??±??' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support. 加上serverTimezone=GMT 参考地址 con = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/test?useSSL=true&serverTimezone=GMT", "root", "123456")

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值