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就行了 

     访问成功如下:

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

  • 相关阅读:
    php switch case的"bug"
    win7 安装redis服务
    linux 查看网卡以及开启网卡
    getSelection、range 对象属性,方法理解,解释
    关于window.getSelection
    富文本原理
    elasticsearch启动常见错误
    Linux 修改用户密码
    centos修改主机名的正确方法
    Dockerfile介绍
  • 原文地址:https://www.cnblogs.com/Sarah-Strawberry/p/11089383.html
Copyright © 2011-2022 走看看