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

     访问成功如下:

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

  • 相关阅读:
    VS2005 GridView操作大全(转载)
    架构与模式
    JS全选与取消
    C#查找指定文件夹下指定后缀名的所有文件
    select poll epoll Hello
    scanf() gets() fgets()使用注意事项 Hello
    gtk_init() Hello
    用C实现FFT算法 Hello
    时间相关函数 Hello
    gcc的编译属性和选项 Hello
  • 原文地址:https://www.cnblogs.com/Sarah-Strawberry/p/11089383.html
Copyright © 2011-2022 走看看