1. Spring Boot 2 初始化数据库脚本 data.sql & user.sql
user.sql :数据表结构
data.sql :数据内容
2. 文件放置的位置 如下表:
3. application.yml 配置写法
pring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/db?serverTimezone=GMT%2B8
username: root
password: root
# 自动加生成表格和加载数据
# schema-username: root
# schema-password: root
# data-username: root
# data-password: root
platform: mysql
schema: classpath:sql/*.sql
data: classpath:sql/data/*.sql
continue-on-error: true
initialization-mode: always