1. 程式人生 > >【MySQL】java.sql.SQLException: The server time zone value

【MySQL】java.sql.SQLException: The server time zone value

wan rac transacti timezone prop 解決 cep enc pass

錯誤:Could not open JDBC Connection for transaction; 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.

解決:為URL添加參數serverTimezone=UTC即可,這裏的時區可以根據自己數據庫的設定來設置(GMT/UTC )。

user.connection.mysql.url=jdbc:mysql://localhost:3306/zhsq?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&user=root&password=root&useSSL=true&serverTimezone=UTC

【MySQL】java.sql.SQLException: The server time zone value