SpringBoot中The server time zone value '?D1ú±ê×?ê±??' is unrecognized问题

本文分享了初学者在SpringBoot环境下整合MyBatis时,配置数据库连接信息的常见问题及解决方案,特别是针对mysql默认服务器时区导致的InvalidConnectionAttributeException异常的处理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

    身为一个初学SpringBoot的小萌新,在自学的过程中每每遇到没有见过的错误,都会非常头大,接下来是我在自学的过程中问题和解决方法,希望对你有帮助。

    在进行SpringBoot对MyBatis进行整合时,需要对数据库的相关信息进行配置,如:
    


spring.datasource.DriverClassName=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/ssm?characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8
spring.datasource.username=root
spring.datasource.password=zxm123456

mybatis.type-aliases-package=com.zxm.pojo  //为实体类取别名,在mapper中可以直接使用驼峰式名称,如user
                                             而不是全名,如com.zxm.pojo.User


    遇到下类问题:  是因为mysql默认服务器时区问题。
    


com.mysql.cj.exceptions.InvalidConnectionAttributeException: 
   The server time zone value '?D1ú±ê×?ê±??' 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.


    修改方法:将mysql中url的配置信息修改成
    


jdbc:mysql://localhost:3306/ssm?characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值