一、問題
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