首页 > 代码库 > MySQLSyntaxErrorException: 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 ...

MySQLSyntaxErrorException: 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 ...

下面是我update数据库时打印出来的异常:

### Error updating database.

Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:

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 ‘in (
‘1‘
)‘ at line 1


错误分析:

MySQL语法错误,并且是在第一行的“ in (‘1‘)‘ ” 的附近检查。


查找错误:

技术分享

上面的SQL语句技术分享是错误的,这里不应该有“=”。


 

解决办法:

删除这个“=”号即可。

 

MySQLSyntaxErrorException: 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 ...