type=InnDB ERROR CREATING TABLE MySQL5.1

  • 2021-01-25 07:57:30
  • OfStack

When building the springmvc framework, the bottom layer uses hibernate4.1.8, and the database uses mysql5.1. When using hibernate to automatically generate database tables, hibernate dialect uses org.hibernate.dialect.MySQLInnoDBDialect, and there will be errors when automatically generating tables, as follows:

[13-04-13 19:11:37.190] {resin-60} You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'type=InnoDB' at line 8

type=InnoDB is available before 5.0, but not after 5.1. If we change type=InnoDB to engine=InnoDB this problem will not occur. However, I want to use Hibernate to automatically build my table. This depends on the database dialect we specify (dialect).

Just change the configuration:

hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect

Is amended as:

hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect

In summary 1, MySQL5InnoDBDialect is used in MySQL5.1 and above


Related articles: