Spring Boot通过JDBC语句执行DDL时出错

PiP*_*Pio 4 spring spring-mvc spring-data-jpa spring-boot

所以我想制作一个简单的 CRUD 应用程序,并使用 MYSQL Workbench 作为数据库。我在 MySQL Workbench 中的连接

Hostname : 127.0.0.1
Port : 3306
Run Code Online (Sandbox Code Playgroud)

我在 MySQL Workbench 中不使用密码。

现在我的应用程序属性如下所示

spring.datasource.url=jdbc:mysql://localhost:3306/employee_management_system?useSSL=false
spring.datasource.username=root
spring.datasource.password=

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

spring.jpa.hibernate.ddl-auto=update
Run Code Online (Sandbox Code Playgroud)

我收到的错误

org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "create table employees (id bigint not null auto_increment, email_id varchar(255), first_name varchar(255), last_name varchar(255), primary key (id)) type=InnoDB" via JDBC Statement
Run Code Online (Sandbox Code Playgroud)

另一个在底部

Caused by: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'type=InnoDB' at line 1
Run Code Online (Sandbox Code Playgroud)

请问有人可以帮忙吗?

小智 9

我认为你的数据库不支持InnoDB引擎。尝试更换

spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQLInnoDBDialect
Run Code Online (Sandbox Code Playgroud)

经过

spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
Run Code Online (Sandbox Code Playgroud)


归档时间:

查看次数:

24750 次

最近记录:

2 年,11 月 前