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 xxx如何解决?
今天遇到一个mysql的1064问题,正常来说一般是语法错误:
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 xxx
最后发现是字段之间少了一个逗号。
很多时候mysql数据库的1064错误会出现类似上面的语法/句法错误,但还有一些情况是表面上根本就看不出有什么错误,也会提示是1064错误,例如下面这个sql语句
insert into order (id) value (1)
他会提示:
#1064 - 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 'order (id) value (1)' at line 1
这个从通常语法上是很难看出什么问题的,但是这个里面有的orde是mysql的关键词,在执行的时候很容易被认错结构或语法,有两种方法来解决这个问题:
1、在order前后加个引用的符号 · , 这个是什么呢?正常美式键盘1的前面那个键,如下:
insert into `order` (id) value (1)
2、更改表名order为其他的名字,例如my_order,如下:
insert into my_order (id) value (1)
还有一种出现数据库1064错误的就是提示语句里面提到的版本问题,版本问题归根结底也是老版本可能不支持新版本的一些语法或者关键词,或者新版本里面去掉了一些老版本的语法或者关键词,这个要根据情况来分析。
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 xxx如何解决?为中国U网原创文章,在不经过允许的情况下,禁止用于商业用途或随意转载,转载请注明出处,并加上本页链接地址:
http://www.cuwww.com/help/detail-81.html