各位用户为了找寻关于mysql错误代码之1064的解决方案的资料费劲了很多周折。这里教程网为您整理了关于mysql错误代码之1064的解决方案的相关资料,仅供查阅,以下为您介绍关于mysql错误代码之1064的解决方案的详细内容
sql语句中词和mysql的关键字冲突了,用 `` (tab键上方)将词括起来就好了。
原来的sql语句
? 1 2 3 4 5 6 7<
insert
id=
"insert"
parameterType=
"com.zhangman.manman.entity.User"
>
insert
into
user
(id, username,
password
,
name
,
desc
,email,birthday,phone,status,createtime,roleId)
values
(#{id,jdbcType=
INTEGER
}, #{username,jdbcType=
VARCHAR
}, #{
password
,jdbcType=
VARCHAR
},
#{
name
,jdbcType=
VARCHAR
}, #{
desc
,jdbcType=
VARCHAR
}, #{email,jdbcType=
VARCHAR
},
#{birthday,jdbcType=
VARCHAR
}, #{phone,jdbcType=
VARCHAR
}, #{status,jdbcType=
INTEGER
},
#{createtime,jdbcType=
DATE
}, #{roleid,jdbcType=
INTEGER
})
</
insert
>
改正后的 sql(注意,字段和表名都用``括起来了)
? 1 2 3 4 5 6 7<
insert
id=
"insert"
parameterType=
"com.zhangman.manman.entity.User"
>
INSERT
INTO
`
user
`
(username, `
password
`,`
name
`,`
desc
`,email,birthday,phone,`status`,createtime,roleId)
VALUES
(#{username}, #{
password
},#{
name
}, #{
desc
},#{email},
#{birthday}, #{phone}, #{status},
#{createtime}, #{roleid})
</
insert
>
补充:MySql ERROR 1064 (42000)同样的错误,不一样的解决方法
开始时代码是这样:
然后运行:
代码根本毫无错误,但为什么会出错呢?在我花了2个小时后终于知道了答案。
我没有加分号!!!!!
修改后代码:
然后再次运行后:
再一次为自己的无知和粗心感到绝望!!!
以上为个人经验,希望能给大家一个参考,也希望大家多多支持。如有错误或未考虑完全的地方,望不吝赐教。
原文链接:https://blog.csdn.net/zm9898/article/details/89526555