高版本SpringBoot连接mysql数据库时区异常报错:The server time zone value is unrecognized or represents more than...
分类:计算机 | Spring | SpringBoot | 异常问题 1137
更新:2021-02-23 21:24:11编辑
1 异常描述
将SpringBoot的版本从2.1.17.RELEASE升级到2.2.10.RELEASE以后,连接mysql数据库时报错“Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: 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”
2 异常解决
原来的mysql连接字符串是:
jdbc:mysql://127.0.0.1:3306/db1?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true
在连接字符串后面加上&serverTimezone=GMT%2B8即可,如下所示:
jdbc:mysql://127.0.0.1:3306/db1?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&serverTimezone=GMT%2B8
猿导航
阅读排行榜
- 1vue和el-table使用经验-如何刷新表格数据10880
- 2three.js加载3D瓦片和3dtiles数据生成交互式地图的开源项目9445
- 3Microsoft Visual C++ Redistributable是什么,有什么作用?7176
- 4mybatis使用经验——mybatis-spring-boot-starter和mybatis的版本对应关系表(持续更新~)5752
- 5uni-app使用经验—vue页面和html页面如何互相调用接口并传参5436
- 6Spring学习经验—@ResponseBody注解的使用说明4844
- 7Intellij IDEA下的版本控制VCS的启用与关闭4782
- 8Druid异常解决经验—java.sql.SQLException url not set4461
- 9如何用批处理命令(bat脚本)启动和停止windows服务4228
- 10nuxt.js项目中如何添加和使用全局变量4097
- 11解决SpringBoot使用maven下载不了jar包的问题3451
- 12linux中解压tar.gz文件报错“gzip: stdin: invalid compressed data--format violated”3340
- 13nuxtjs asyncData使用经验—如何发起多个axios请求并携带参数3205
- 14在Nuxt.js项目的head中引用外部js文件3040
- 15在NVIDIA控制面板设置参数时提示“拒绝访问 无法应用选定的设置到您的系统”的解决方法之一3018