🔻Back-End/Database
[MySQL error] 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=MyISAM'
_니지
2024. 8. 10. 23:31
❗문제상황
jpa의 ddl-auto 옵션을 update로 설정하고 Image 클래스를 추가하여 image 테이블을 자동 생성하려고 하는 상황 중 발생한 에러이다
❗해결방법
create table `image` (
id bigint not null auto_increment,
created_at datetime,
updated_at datetime,
url varchar(255),
primary key (id)
) type=MyISAM"
자동 생성되는 테이블의 create문의 type=MyISAM에서 에러가 발생한다는 오류 문구였다.
MySQL은 버전에 따라 사용한 문법이 다를 수 있는데 현재 버전은 8.0.35였다. MySQL 8.0 이상에서는 'type' 키워드 대신 'engine' 키워드로 바꿔서 사용해야 했다.
jpa:
hibernate:
ddl-auto: update
show-sql: true
properties:
hibernate:
format_sql: true
database-platform: org.hibernate.dialect.MySQL8Dialect
따라서 MySQLDialect 대신에 MySQL8Dialect로 바꿔서 사용해야 한다!
다시 정상적으로 작동됨을 볼 수 있다.
728x90
반응형