Springboot2.0中jpa默认创建的mysql表为myisam引擎问题

使用Springboot2.0后,使用jpa操作mysql数据库时,默认创建的表的引擎是myisam,myisam是不能加外键的,找了一些资源,最终可以用此方法解决!

yml格式:

spring:
  jpa:
    database: mysql
    show-sql: true
    hibernate:
      ddl-auto: update
      naming:
        physical-strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect  #不加这句则默认为myisam引擎

properties格式:

spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL55Dialect
原文地址:https://www.cnblogs.com/WPF0414/p/9885615.html