Hibernate: Create Mysql InnoDB tables instead of MyISAM

Can't you specify the Hibernate dialect and use

hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect

Edit

From MySQL version > 5.1 this should be

hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect

to avoid running into this issue Using "TYPE = InnoDB" in MySQL throws exception


Go to this link:

mysql-dialect-refactoring

It clearly says :

Traditionally, MySQL used the non-transactional MyISAM storage engine, and this is the default storage engine for all Dialects that are older than MySQL55Dialect. From MySQL55Dialect onwards, the InnoDB storage engine is used by default.

Put the following in your application.properties (or in your config):

spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL55Dialect

Notice 55 in above. - not just 5.

And you can see it in the console too:

Hibernate: create table users_events (user_id bigint not null, event_id bigint not null) engine=InnoDB
Hibernate: create table users_roles (user_id bigint not null, role_id bigint not null) engine=InnoDB

Hope it helps.