【问题标题】:InnoDB on Spring Boot 2.0.x?Spring Boot 2.0.x 上的 InnoDB?
【发布时间】:2019-03-05 22:55:34
【问题描述】:

请问在 Spring Boot 2.0.x 中如何配置“hibernate.dialect.storage_engine = innodb”属性?

  • Spring Boot 2.0.5.RELEASE
  • MySQL 社区服务器 8.0.11

application.properties:

spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.dialect.storage_engine=innodb
spring.jpa.show-sql=true

MySQL 服务器变量:

default_storage_engine=InnoDB
default_tmp_storage_engine=InnoDB

Spring Boot 控制台输出:

Hibernate: 

    drop table if exists person
Hibernate: 

    create table person (
       id bigint not null auto_increment,
        address varchar(255),
        age integer,
        city varchar(255),
        info varchar(255),
        telephone varchar(255),
        zip_code varchar(255),
        email varchar(255) not null,
        first_name varchar(255) not null,
        last_name varchar(255) not null,
        version bigint,
        primary key (id)
    ) engine=MyISAM

【问题讨论】:

    标签: mysql spring-boot innodb


    【解决方案1】:

    你应该使用spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect

    【讨论】:

      【解决方案2】:

      你可以试试这个:

      spring.jpa.database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
      

      【讨论】:

        猜你喜欢
        • 2019-02-20
        • 2018-08-03
        • 2018-12-20
        • 1970-01-01
        • 2019-06-27
        • 2015-02-05
        • 2014-06-02
        • 2022-08-10
        • 2018-08-17
        相关资源
        最近更新 更多