Search code examples
mysqlhibernatespring-bootdialect

Spring Boot - MySQL use InnoDB as default


I want to create my database tables with InnoDB, I'm using Spring Boot 2.1.3 and MySQL 8.0, so i used this:

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

And, yeah, it works, but i got a lot of errors in my console:

2019-04-03 19:11:55.182  INFO 1820 --- [  restartedMain] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect
2019-04-03 19:11:55.966  WARN 1820 --- [  restartedMain] o.h.t.s.i.ExceptionHandlerLoggedImpl     : GenerationTarget encountered exception accepting command : Error executing DDL "alter table application drop foreign key FKldca8xj6lqb3rsqawrowmkqbg" via JDBC Statement

org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "alter table application drop foreign key FKldca8xj6lqb3rsqawrowmkqbg" via JDBC Statement

And this one for each of my table:

Caused by: java.sql.SQLSyntaxErrorException: Table 'test.usr' doesn't exist

"test.usr" -> "test" is my schema name, and "usr" is a table name.

But it still creates all of my tables, so how can i get rid of this errors?


Solution

  • As Antoniossss proposed, I've just used Flyway to handle my database. Thanks.