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

你可能感兴趣的:(Could not create connection to database server. Attempted reconnect 3 times.)