Spring Boot MySQL數據庫連接

1. 導入MySQL依賴

		<dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>

2. application.yml中配置

spring:
  datasource:
    url: jdbc:mysql://IP地址:端口號/數據庫名?serverTimezone=GMT%2B8&useServerPrepStmts=true&rewriteBatchedStatements=true
    username: 數據庫用戶名
    password: 數據庫密碼
3. Spring Boot MySQL數據庫連接成功!!!
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章