mysql连接指定时区_mysql的连接配置时区问题

mysql 5之前的配置:

driverClassName=com.mysql.jdbc.Driver

url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&useSSL=false

username=****

password=****

------------------------------------

mysql 6之后的配置:

设置时区serverTimezone为UTC比北京时间早8个小时。

driverClassName=com.mysql.cj.jdbc.Driver

url=jdbc:mysql://localhost:3306/test?serverTimezone=UTC&?useUnicode=true&characterEncoding=utf8&useSSL=false

username=****

password=****

-------------------------------------

设置时区为Asia/Shanghai为北京时间

driverClassName=com.mysql.cj.jdbc.Driver

url=jdbc:mysql://localhost:3306/test?serverTimezone=Asia/Shanghai&?useUnicode=true&characterEncoding=utf8&useSSL=false

username=****

password=****

原文:https://www.cnblogs.com/dashuai-wang/p/12850506.html

你可能感兴趣的:(mysql连接指定时区)