mysql出现错误:The server time zone value is unrecognized or represents more than one time zone

  Mysql错误:The server time zone value is unrecognized or represents more than one time zone

  mysql的时区和本机的时区不一样

 解决方案:

   第一、可以通过把我们连接的时区改成和mysql一致

为URL添加参数 serverTimezone=UTC 即可, 这里的时区可以根据自己数据库的设定来设置(GMT/UTC )
jdbc:mysql://localhost:3306/dbname?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
这样会出现和我们真正的事件相差8个小时的情况

还有几种比较好用的方案  地址:http://www.jb51.net/article/84198.htm


你可能感兴趣的:(数据库)