1. 程式人生 > 實用技巧 >IDEA--Could not create connection to database server

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)並同步在這裡插入圖片描述

3、檢測MySQL驅動名,改為driver-class-name: com.mysql.cj.jdbc.Driver

在這裡插入圖片描述