springboot的MySQL报错: Malformed database URL, failed to parse the main URL sections.

2022-12-16 17:34:47.911 ERROR 2788 --- [main] com.alibaba.druid.pool.DruidDataSource   : init datasource error, url: jdbc:mysql://localhost:3306//yn_park?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false

java.sql.SQLNonTransientConnectionException: Cannot load connection class because of underlying exception: com.mysql.cj.exceptions.WrongArgumentException: Malformed database URL, failed to parse the main URL sections.

我自己的解决方式
检查URL是否写错,我的项目连接的数据库url是这么写的:

jdbc:mysql://localhost:3306//yn_park?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false

细心的小伙伴肯定发现了这个很搓的bug,3306后面多了一个/,之前一只没想到,现在记录一下

你可能感兴趣的:(mysql,spring,boot,数据库)