Maven连接数据库是报[08001]Connection to mybatis@localhost failed. [08001] Could not create connection to database server. Attempted reconnect 3 times
错误截图:

原因:
时区不对,url需改成jdbc:mysql://localhost:3306/database?serverTimezone=GMT
添加红色部分到URL区域即可。当然这些前提都必须是数据库连接参数配置无误的情况下。
修改后截图:


浙公网安备 33010602011771号