Could not create connection to database server. Attempted reconnect 3 times. Giving up.(JDBC连接MYSQL)

写个JDBC连接Mysql数据库,配置什么的都没有问题居然报了个这样的错误,百度翻译:无法创建到数据库服务器的连接。尝试重新连接3次。放弃     Could not create connection to database server. Attempted reconnect 3 times. Giving up.

首先检查自己的mysql驱动版本,是否对应自己的mysql安装版本。后来查阅资料发现是时区设置不正确。

解决办法:在jdbc连接的url后面加上serverTimezone=GMT

连接成功!

猜你喜欢

转载自blog.csdn.net/ke_new/article/details/107091955