MySQL"ALTER IGNORE TABLE"语法错误 [英] MySQL "ALTER IGNORE TABLE" Error In Syntax
问题描述
我正在尝试运行查询:
ALTER IGNORE TABLE test_table DROP PRIMARY KEY, ADD PRIMARY KEY(id);
test_table只是我用于测试目的的临时表,而id是其中的一列.
test_table is just a temporary table I'm using for testing purposes, and id is a column in it.
该查询在没有"IGNORE"关键字的情况下仍能正常工作,但是当我添加该关键字时,会收到错误消息:
The query works fine without the "IGNORE" key word, but when I add it I get the error message:
错误代码:1064.您的SQL语法有错误;请查看与您的MySQL服务器版本相对应的手册,以获取在第1行'IGNORE TABLE test_table ADD PRIMARY KEY(id)'附近使用的正确语法"
"Error Code: 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 'IGNORE TABLE test_table ADD PRIMARY KEY(id)' at line 1"
我该如何解决?或者如何运行该查询并忽略可能发生的任何错误?谢谢!
How do I fix this? Or how can I run that query and ignore any errors that might occur? Thanks!
推荐答案
从MySQL 5.7.4开始,ALTER TABLE的IGNORE子句被删除,使用它会产生错误.请检查您的版本
As of MySQL 5.7.4, the IGNORE clause for ALTER TABLE is removed and its use produces an error. Please check your version
这篇关于MySQL"ALTER IGNORE TABLE"语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!