Caused by: com.mysql.cj.core.exceptions.InvalidConnectionAttributeException: The server time zone...

    xiaoxiao2022-07-02  100

    spring boot + mybaits 出现异常:

    org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: Error updating database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: 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. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: The server time zone value

    愿因:必须在连接字符串中明确指定serverTimezone。

    解决:

    jdbc:mysql://localhost:3306/lovewhf?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC 在这里边明确指定serverTimezone
    最新回复(0)