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

     访问成功如下:

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

  • 相关阅读:
    dotnet 控制台读写 Sqlite 提示 no such table 找不到文件
    dotnet 控制台读写 Sqlite 提示 no such table 找不到文件
    dotnet 控制台 Hangfire 后台定时任务
    dotnet 控制台 Hangfire 后台定时任务
    dotnet 获取指定进程的输入命令行
    dotnet 获取指定进程的输入命令行
    PHP sqrt() 函数
    PHP sinh() 函数
    PHP sin() 函数
    PHP round() 函数
  • 原文地址:https://www.cnblogs.com/Sarah-Strawberry/p/11089383.html
Copyright © 2011-2022 走看看