1. 程式人生 > >java連線MYSQL80資料庫驅動出現java.sql.SQLException:

java連線MYSQL80資料庫驅動出現java.sql.SQLException:

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.
解決辦法:
你原先的JDBCURL:jdbc:mysql://localhost:3306/mydatabase


在此基礎上新增:?serverTimezone=UTC也就是:jdbc:mysql://localhost:3306/mydatabase?serverTimezone=UTC
但如果你的JDBCURL類似下面:

jdbc:mysql://localhost:3306/mydatabase?serverTimezone=UTC&characterEncoding=utf-8

就是有多個params的時候需要以&分開,但&要改為& 如下:

jdbc:mysql://localhost:3306/mydatabase?serverTimezone=UTC&characterEncoding=utf-8