为将项目从postgre库转为本地mysql数据库,需要将数据库驱动改为mysql
1.在父工程的pom中引入数据库
<!-- Mysql驱动包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.28</version>
</dependency>
2.在配置文件中application.yml中写引入的主数据库驱动和连接信息
datasource:
hikari:
auto-commit: false
type: com.alibaba.druid.pool.DruidDataSource
# driverClassName: org.postgresql.Driver
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
url: jdbc:mysql://localhost:3306/mydb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: 'root'
发现引入的驱动名报红,我的解决方式是