application.yml中mysql
时间: 2023-09-05 16:14:50 浏览: 99
在application.yml中配置MySQL数据库需要添加以下内容:
```
spring:
datasource:
url: jdbc:mysql://localhost:3306/wiki?characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver
```
其中,`url`字段表示数据库的连接地址,`username`字段表示数据库的用户名,`password`字段表示数据库的密码,`driver-class-name`字段表示数据库驱动的类名。这样配置后,你就可以在Spring Boot项目中使用MySQL数据库了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [SpringBoot 配置 application.yml连接MySQL数据库](https://blog.csdn.net/qq_45830969/article/details/122697715)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [SpringBoot项目application.yml文件数据库配置密码加密的方法](https://download.csdn.net/download/weixin_38702110/12727256)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文