Could not create connection to database server. Attempted reconnect 3 times.

一、問題

Could not create connection to database server. Attempted reconnect 3 times.

二、問題分析

在Spring-boot項目中使用jdbc連接數據庫時報錯,依賴的mysql-connector-java版本爲8.0.19,url連接爲:

jdbc:mysql://localhost:3306/web_video?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false&allowPublicKeyRetrieval=true

查閱文檔得知是未設置時區,添加:

&serverTimezone=UTC

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章