java连接5.1以上的mysql出现问题---The server time zone value '???ú±ê×??±??' is unrecognized or represents more than one time zone.

错误环境:

MySQL 5.7

错误原因:

使用了MySQL新版驱动

解决办法:

方案1、在项目代码-数据库连接URL后,加上 (注意大小写必须一致)?serverTimezone=UTC

static final String DB_URL = "jdbc:mysql://localhost:3306/cyx?serverTimezone=UTC";

方案2、在mysql中设置时区,默认为SYSTEM
set global time_zone='+8:00'

温润如玉,坚毅如铁。
原文地址:https://www.cnblogs.com/heisen/p/9957713.html