0
点赞
收藏
分享

微信扫一扫

MyBatis中提示:You have an error in your SQL syntax; check the manual that corresponds to your MySQL ser


场景

在进行MyBatis查询数据时提示:

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 ' select * from users where userName

= 'badao'' at line 1

MyBatis中提示:You have an error in your SQL syntax; check the manual that corresponds to your MySQL ser_sql语句

可以确定是sql语句有问题。

定位到此sql语句的位置是userMapper.xml

但是复制出来sql语句以及控制台报错的语句能在数据库中查询出数据。

实现

确定执行的sql没有语法错误外,考虑去掉所有无关的空格和换行等。

MyBatis中提示:You have an error in your SQL syntax; check the manual that corresponds to your MySQL ser_sql语句_02

然后将全部内容剪切出来,然后保存,然后再将内容粘贴回去,然后保存。

竟然不报错了。

举报

相关推荐

0 条评论