数据库
首页 > 数据库> > MySql访问冲突或语法错误

MySql访问冲突或语法错误

作者:互联网

尝试执行下面的sql语句时出现以下错误.

SQLSTATE[42000]: Syntax error or access violation: 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 'like, agree, favor, discriminator) VALUES ('5023fb89189df', 0, '2012-08-09 14:03' at line 1

完整的sql语句如下

INSERT INTO activity (id, hide_author, created, updated, access, location, disabled, created_ip, updated_ip, params, body, audit, hide_activity, author, owning_activity, like, agree, favor, discriminator) VALUES ('5023fa5a63d1b', NULL, '2012-08-09 13:58:50', '2012-08-09 13:58:50', NULL, NULL, 0, '192.168.1.1', NULL, NULL, 'Exactly, I would prefer to be able to defend myself when the unthinkable happens', NULL, 0, '50143c83e3f5a', '5023e63dafe18', 1, NULL, NULL, 'commentpost')

我没有看到语法上的任何错误,但是也许您可以就可能导致何种访问冲突的问题提出一些建议.我应该找什么?

解决方法:

“赞”是SQL中的保留字.将其装在反引号中.这就是您计算机上“ 1”旁边的键,如下所示:

INSERT INTO activity (id, hide_author, created, updated, access, location, disabled, created_ip, updated_ip, params, body, audit, hide_activity, author, owning_activity, `like`, agree, favor, discriminator) VALUES ('5023fa5a63d1b', NULL, '2012-08-09 13:58:50', '2012-08-09 13:58:50', NULL, NULL, 0, '192.168.1.1', NULL, NULL, 'Exactly, I would prefer to be able to defend myself when the unthinkable happens', NULL, 0, '50143c83e3f5a', '5023e63dafe18', 1, NULL, NULL, 'commentpost')

标签:access-violation,sql,mysql
来源: https://codeday.me/bug/20191101/1980212.html