IDEA--Could not create connection to database server

在springboot项目运行时,出现Could not create connection to database server报错;
原因:mysql版本号和maven中pom文件中配置的mysql-connector版本号不同。
解决方案:将pom文件中的版本号改成本地mysql的版本号以后再更新maven
步骤:
1、在win+r中连接MySQL,输入select version() from dual;查询出自己的MySQL版本;
2、在pom.xml中加入 8.0.17(我的MySQL版本是8.0.17)并同步IDEA--Could not create connection to database server

3、检测MySQL驱动名,改为driver-class-name: com.mysql.cj.jdbc.Driver
IDEA--Could not create connection to database server