MySQL JDBC Driver 5.1.33 - Time Zone Issue

前端 未结 30 1192
栀梦
栀梦 2020-11-22 05:22

Some background:

I have a Java 1.6 webapp running on Tomcat 7. The database is MySQL 5.5. Previously, I was using Mysql JDBC driver 5.1.23 to connect to the DB. Ever

30条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-22 05:53

    1. I added in mysql config file in section [mysqld]

      default_time_zone='+03:00'
      
    2. And restart mysql server:

      sudo service mysql restart
      

    Where +03:00 my UTC time zone.

    Path to config file on my os ubuntu 16.04:

    /etc/mysql/mysql.conf.d/mysqld.cnf
    

    WARNING: IF YOUR TIME ZONE HAVE SUMMER AND WINTER TIME. YOU MUST CHANGE UTC IN CONFIG IF CHANGE TIME. TWICE IN YEAR(USUALLY) OR SET CRONTAB WITH SUDO.

    My url jdbc connection:

    "jdbc:mysql://localhost/java"
    

提交回复
热议问题