zoukankan      html  css  js  c++  java
  • 解决java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone

    使用spring boot整合MySQL时一直报

    java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone

    报错信息

    系统时区的错误

    查看mysql时区

    show VARIABLES like "%time_zone%"

    解决方法:

      1.在原来的参数“url”后面,拼上这个字符串:?serverTimezone=GMT%2B8,

        如:jdbc:mysql://localhost:3306/test?serverTimezone=GMT%2B8

          东八区的表示:

            GMT%2B8,GMT+8,北京时间东八区

            Asia/Shangha,上海时间

          为何没有asia/beijing时区? 

      2.设置mysql的时区

        MySQL默认的时区是UTC时区

        (1)永久的修改:修改mysql的配置文件,添加:default-time-zone='+08:00',重启mysql生效

                  (2)临时的修改:执行mysql命令 set global time_zone='+08:00',立即生效,重启mysql后失效

      

        



        
  • 相关阅读:
    UML建模之用例图关系
    python模块介绍
    Delphi操作XML(七)
    Delphi操作XML(一)
    Delphi操作XML(五)
    Delphi操作XML(六)
    Delphi操作XML(二)
    Delphi操作XML(四)
    Delphi操作XML(三)
    决心好好写cnblogs
  • 原文地址:https://www.cnblogs.com/baby123/p/10436095.html
Copyright © 2011-2022 走看看