1.将resources文件夹里面的application文件修改为 application.yml文件,在里面添加内容:
spring:
datasource:
username: root
password: lytcreate
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/demo?characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
2.修改pom.xml文件在 dependencies里面增加:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.23</version>
</dependency>
3.使用maven更新依赖
![](https://i-blog.csdnimg.cn/direct/d05416805af64ec8864b09a17ae996b8.png)
4.更新
![](https://i-blog.csdnimg.cn/direct/dc942bf8f1c940eb89ff9cd36141753d.png)