Mysql ERROR 1064 (42000)
Posted 一沙世界
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mysql ERROR 1064 (42000)相关的知识,希望对你有一定的参考价值。
创建了一个表:
1 +-------------+--------------+------+-----+---------+----------------+ 2 | Field | Type | Null | Key | Default | Extra | 3 +-------------+--------------+------+-----+---------+----------------+ 4 | id | int(11) | NO | PRI | NULL | auto_increment | 5 | model | varchar(80) | NO | | NULL | | 6 | type | varchar(32) | NO | | NULL | | 7 | name | varchar(48) | NO | | NULL | | 8 | price | varchar(32) | NO | | NULL | | 9 | salePrice | varchar(32) | NO | | NULL | | 10 | traderPrice | varchar(32) | NO | | NULL | | 11 | picture | varchar(128) | NO | | NULL | | 12 | desc | varchar(128) | NO | | NULL | | 13 +-------------+--------------+------+-----+---------+----------------+
执行以下语句:
mysql> insert into product (model,type,name,price,salePrice,traderPrice,picture, desc) values("WZC504-TZ","开关","双速","60","51","41","eb3.jpg","");
得到错误信息:
1 ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that 2 corresponds to your MySQL server version for the right syntax to use near ‘desc 3 ) values("WZC504-TZ","开关","双速","60","51","41","eb3.jpg","")‘ at line 1
原因:列名跟Mysql的关键字重叠。
那就应该是desc的起名问题了,修改为describe,依然报错。这两个都是Mysql的关键字!
改成description,问题解决。
以上是关于Mysql ERROR 1064 (42000)的主要内容,如果未能解决你的问题,请参考以下文章
UDF 触发器不起作用 MySQL ERROR 1064 (42000)
MySQL ERROR 1064 (42000)——不管怎样grant总是报错,怎么回事?
ERROR 1064 (42000)MySQL中使用mysqladmin或set修改root密码时提示语法错误
解决mysql 8报错 ERROR 1064 (42000): You have an error in your SQL syntax
解决mysql 8报错 ERROR 1064 (42000): You have an error in your SQL syntax