**出错场景:使用idea连接mysql(5.2版本)报错:
java.lang.com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support…
大概原因:JDBC驱动程序的5.2版本与UTC时区配合使用,必须在连接字符串中明确指定server Time zone.
解决方法:
// jdbc:mysql://localhost:3306/testuseUnicode=true&characterEncoding=8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC;