1. 程式人生 > 資料庫 >Mybatis-Plus報錯:java.sql.SQLException: The server time zone value ‘�й���׼ʱ��‘ is unrecognized or repr

Mybatis-Plus報錯:java.sql.SQLException: The server time zone value ‘�й���׼ʱ��‘ is unrecognized or repr

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.
在這裡插入圖片描述

方法一:在配置檔案中url後加:&serverTimezone=GMT
如:url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT
方法二:在配置檔案中url後加:&serverTimezone=Asia/Shanghai
如:url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai

方法三:在配置檔案中url後加:&serverTimezone=GMT%2B8
如:url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
方法四:在配置檔案中url後加:&serverTimezone=UTC
如:url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC

以上方法親測有效