在spring+mybatis項目中,在pom.xml添加一下依賴後
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.11</version>
</dependency>
出現如下錯誤:
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.
這是系統時間錯誤。這是在使用MySQL 8.0以上版本(MySQL連接驅動和版本都是8.0以上)的時候出現的問題錯誤,我們需要在訪問數據庫的Url後面加上以下的語句即可:
jdbc:mysql://localhost:3306/yd?serverTimezone=GMT%2B8