Connection to mysql@localhost failed. [08001] Could not create connection to database server. Attemp

idea连接MySQL报错

在这里插入图片描述

解决方案:

在URL后面增加?serverTimezone=GMT
例如:

jdbc:mysql://localhost:3306/mysql?serverTimezone=GMT

下图为完整截图
在这里插入图片描述
原因分析
因为我们系统的默认的时间格式与idea中连接数据库的字符格式不一样,所以会报出现的错误。

猜你喜欢

转载自blog.csdn.net/qq_37955704/article/details/104227774