MySQL JDBC Driver 5.1.33 - Time Zone Issue

前端 未结 30 1928
栀梦
栀梦 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条回答
  •  说谎
    说谎 (楼主)
    2020-11-22 06:00

    There is no impact of setting server time as UTC (for instance with jdbc:mysql://localhost:3306/myschema?serverTimezone=UTC, even if your application/database servers are not in this timezone. The important is for the application connection string + database to be synchronized with the same time zone.

    In other words, simply setting serverTimezone=UTC with a different time zone on the database server will shift any dates extracted from the database

提交回复
热议问题