天天看點

java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents moreSpringboot 項目啟動後運作報錯

Springboot 項目啟動後運作報錯

安楠大叔

  • 說實話,在我們做項目的時候,肯定會遇到各種各樣的錯誤,遇到問題我們不要慌,因為這是很正常的,不寫Bug的程式員不是号程式員,哈哈,調侃一下
  • 遇到問題我們解決問題,一步一步來看

項目啟動正常

java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents moreSpringboot 項目啟動後運作報錯

調用接口——報錯

java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents moreSpringboot 項目啟動後運作報錯

背景報錯

java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents moreSpringboot 項目啟動後運作報錯

錯誤點

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.
           
  • 這個錯誤是因為時區錯誤,對的,因為我們是在東八區,是以在配置檔案裡面,将連接配接資料庫的地方添加
?serverTimezone=GMT%2B8
           
  • 添加完成之後是這樣的
url: jdbc:mysql://127.0.0.1:3306/sao?serverTimezone=GMT%2B8
           

然後我們再次啟動項目并且調用項目

-

java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents moreSpringboot 項目啟動後運作報錯

請求成功

  • 看到我們請求成功,那就說明我們的項目是沒有問題的,隻是因為時區,是以我們在遇到沒有遇到的問題的時候,我們要積極的找尋錯誤原因是什麼

大家加油啦——相信你們是最棒的,安楠大叔一直在這裡等你凱旋歸來

繼續閱讀