问题解决方案
Spring boot 连接mysql数据库时,在部分环境中会出现The server time zone value 'EDT' is unrecognized异常。
com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value 'EDT' 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:mysql://ip:port/database_name?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true
为了解决这个问题,按照网上资料,在url中添加serverTimezone=GMT
jdbc:mysql://ip:port/database_name?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=GMT
问题解决,应用启动正常。
但是,为了节约资源,进行测试,应用和数据库部署在同一台机器上,所以,不存在数据库和应用所在服务