使用MySQL時出現The server time zone value '�й���׼ʱ��' is unrecogni的解決方法


開發數據庫相關的項目時,出現如下的異常:org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain 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.

 

解決辦法:

根據提示需要在配置數據庫的連接信息中,在MySQL的URL后面加上“?serverTimezone=UTC” ,如下所示:

spring.datasource.url=jdbc:mysql://127.0.0.1:3306/test?serverTimezone=UTC

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM