spring boot连接mysql8.0
今天spring boot的项目数据库从mysql5.7换到mysql8.0,遇到点问题,特此记录下来
查看mysql的版本
mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.12 |
+-----------+
修改mysql的依赖使用MySQL Connector/J
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.</version>
</dependency>
数据源配置
# 数据源配置,请修改为实际配置
spring.datasource.url=jdbc:mysql://localhost:3306/bim?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false&failOverReadOnly=false
spring.datasource.username=bimengine
spring.datasource.password=fgBQLZpgDaxH7xuu
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
项目启动如果报错
java.sql.SQLException: The connection property 'zeroDateTimeBehavior' acceptable values are: 'CONVERT_TO_NULL', 'EXCEPTION' or 'ROUND'. The value 'convertToNull' is not acceptable.
修改数据源配置
# 数据源配置,请修改为实际配置
spring.datasource.url=jdbc:mysql://localhost:3306/bim?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=CONVERT_TO_NULL&autoReconnect=true&useSSL=false&failOverReadOnly=false
spring.datasource.username=bimengine
spring.datasource.password=fgBQLZpgDaxH7xuu
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
如果报错
java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowe
连接数据库的url中,加上allowPublicKeyRetrieval=true参数
spring boot连接mysql8.0的更多相关文章
- spring boot配置MySQL8.0 Druid数据源
创建spring boot项目,在pom中添加相应依赖 <!--web--> <dependency> <groupId>org.springframework.b ...
- Spring boot连接3.03以上的mongodb 权限验证问题
由于3.0.3,mongodb加入了SCRAM-SHA-1校验方式,需要第三方工具配合进行验证,所有Spring boot连接MongoDB时会出现用户认证失败. 解决方法: > use adm ...
- spring boot 连接Mysql介绍
Spring Boot 集成教程 Spring Boot 介绍 Spring Boot 开发环境搭建(Eclipse) Spring Boot Hello World (restful接口)例子 sp ...
- Spring Boot 2.3.0正式发布:优雅停机、配置文件位置通配符新特性一览
当大潮退去,才知道谁在裸泳..关注公众号[BAT的乌托邦]开启专栏式学习,拒绝浅尝辄止.本文 https://www.yourbatman.cn 已收录,里面一并有Spring技术栈.MyBatis. ...
- Spring Boot 2.3.0 新特性Redis 拓扑动态感应
本文为原创文章.欢迎任何形式的转载,但请务必注明出处 冷冷https://lltx.github.io. Spring Boot 2.3 新特性优雅停机详解 Spring Boot 2.3 新特性分层 ...
- Spring Boot 2.5.0 发布:支持Java16、Gradle 7、Datasource初始化机制调整
今年520的事情是真的多,娱乐圈的我们不管,就跟DD一起来看看 Spring Boot 2.5.0 的发布吧!看看都带来了哪些振奋人心的新特性和改动! 主要更新 支持 Java 16 支持 Gradl ...
- Spring Boot 2.1.0 已发布,7 个重大更新!
距离<重磅:Spring Boot 2.0 正式发布!>已经过去大半年了,而 Spring Boot 2.1.0 在 10 月底就发布了,我们来看下 Spring Boot 2.1.0 都 ...
- (转)Spring Boot 2 (九):【重磅】Spring Boot 2.1.0 权威发布
http://www.ityouknow.com/springboot/2018/11/03/spring-boot-2.1.html 如果这两天登录 https://start.spring.io/ ...
- 【重磅】Spring Boot 2.1.0 权威发布
如果这两天登录 https://start.spring.io/ 就会发现,Spring Boot 默认版本已经升到了 2.1.0.这是因为 Spring Boot 刚刚发布了 2.1.0 版本,我们 ...
随机推荐
- leaf框架(一) 部署leaf
获取 LeafServer: git clone https://github.com/name5566/leafserver 将下下来的文件里server放入gopath的src下,bin里的文件也 ...
- idea 将java导出为可执行jar及导入jar依赖
使用maven可以很好的帮助我们进行依赖的管理,也可以使用maven的jar包打包插件构建出可运行的jar.那针对不是用maven进行管理的普通java项目,可以通过以下方式导出可执行的jar包以及导 ...
- OpenCV 学习笔记(5) 使用opencv打开笔记本摄像头
#include "stdafx.h" #include <opencv2\opencv.hpp> #include <iostream> #include ...
- 11.06水题Test
11.06水题比赛 题目 描述 做法 \(BSOJ5150\) 求\(n\)个数两两之差的中位数 二分中位数,双指针判定\(\le x\)差值对数 \(BSOJ5151\) 求树的最大匹配和其个数 来 ...
- csp 201903-3 损坏的RAID5
问题描述 试题编号: 201903-3 试题名称: 损坏的RAID5 时间限制: 1.0s 内存限制: 512.0MB 问题描述: 答题栏 核
- CentOS 7.5安装ANSYS 19.2
源视频链接: https://pan.baidu.com/s/12v2NPi54qvuR4wftAtYsQw 提取码: 9pst
- Spring不能直接@autowired注入Static变量
一.业务场景 spring框架应用中有些静态方法需要依赖被容器管理的类,就像这样: @Component public class Test { @Autowired private static U ...
- [技术博客]React-Native中的组件加载、卸载与setState问题
React-Native中的组件加载.卸载与setState问题. Warning: Can only update a mounted or mounting component. This usu ...
- Why you need to understand garbage collection
Why you need to understand garbage collection I’ve been interviewing lots of C# developers recently, ...
- Linux下的IO监控与分析(转)
各种IO监视工具在Linux IO 体系结构中的位置 源自 Linux Performance and Tuning Guidelines.pdf 1 系统级IO监控 iostat iostat -x ...