一 描述:mysql连接时显示 Cannot resolve class or package 'jdbc'
pom文件中显示:Failed to read artifact descriptor for mysql:mysql-connector-java:jar:8.0.25
运行时显示:Cannot load driver class: com.mysql.jdbc.Driver
解决:在yml文件:
spring:
datasource:
username: root
password: root
url: jdbc:mysql://192.168.56.10:3306/gulimail_pms
driver-class-name: com.mysql.jdbc.Driver
填写 com.mysql.jdbc.Driver 后 driver-class-name左侧出现红色叹号 ,通过此处将驱动加载到路径即
二 相关数据库找不到、人人代码生成器生成逆向代码是出错:找不到数据库
解决:common文件中mysql版本为8.0.17,scope不写,重写配置文件中的数据库配置:
spring:
datasource:
username: root
password: root
url: jdbc:mysql://192.168.56.10:3306/gulimall_ums?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
driver-class-name: com.mysql.jdbc.Driver
三 create connection SQLException, url: jdbc:mysql://localhost:3306/xxxx
重新编辑配置文件中的mysql连接信息