解决Spring Boot中MySQL数据库报错“Bad SQL Grammar”的问题
目录
在使用Spring Boot连接MySQL数据库时,有时候会遇到“Bad SQL Grammar”错误,这种错误通常在执行SQL语句时发生。本文针对的是对于执行多条SQL语句的情况。
问题描述
出现错误的SQL语句如下:
<delete id="truncateUserInfo">
truncate table sys_user;
truncate table sys_user_info;
truncate table sys_role_info;
</delete>
执行这个SQL语句时,可能会抛出BadSqlGrammarException
,错误信息如下: