zoukankan      html  css  js  c++  java
  • 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

    启动springboot就报错

    Error querying database.  Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Access denied for user ''@'localhost' (using password: YES)

    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.
    这是因为 servertime=UTC导致时间差8个小时(MySQL jdbc 6.0 版本以上必须配置此参数)

    UTC代表的是全球标准时间 ,但是我们使用的时间是北京时区也就是东八区,领先UTC八个小时。

    UTC + (+0800) = 本地(北京)时间

    而我们的配置文件application.yml中的url用的是北京时间。所以会报错。

    更改前的application.yml相关配置信息:

    更改方案:

    在url后面加上这个就可以了

    1 &serverTimezone=UTC 代表全球标准时间 
    2 serverTimezone=Asia/Shanghai 代表中国的时间,建议用这个,这样写入和读取时间一致。
    &useSSL=false 这个是url是否拼接,选择false就行了 

     访问成功如下:

     愿可以帮到你.........

  • 相关阅读:
    桥梁模式
    原型模式
    css backgroundposition
    eclipse配置了maven,项目报错
    SQL 练习题目
    Springmvc + Ibatis 搭建 点餐系统
    Delphi 性能优化工具
    Delphi的接口陷阱
    delphi 内存管理,定期释放
    Delphi制作数据感知控件之浮想联翩
  • 原文地址:https://www.cnblogs.com/Sarah-Strawberry/p/11089383.html
Copyright © 2011-2022 走看看