Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection

一、问题

Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: 
Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: 
The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone. 

二、解决

原因:MySQL8要求必须设置时区

解决方案:

加上红色框里的值,设置时区
在这里插入图片描述
在这里插入图片描述

三、扩展

因为使用springboot,它强制将驱动设置成了MySQL8的,所以可能还会有一个建议:

Loading class `com.mysql.jdbc.Driver'. This is deprecated. 
The new driver class is `com.mysql.cj.jdbc.Driver'. 
The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.

解决方案:
在这里插入图片描述