简体   繁体   English

MySQL“ALTER IGNORE TABLE”语法错误

[英]MySQL “ALTER IGNORE TABLE” Error In Syntax

I am trying to run the query: 我正在尝试运行查询:

ALTER IGNORE TABLE test_table DROP PRIMARY KEY, ADD PRIMARY KEY(id);

test_table is just a temporary table I'm using for testing purposes, and id is a column in it. test_table只是我用于测试目的的临时表,而id是其中的一列。

The query works fine without the "IGNORE" key word, but when I add it I get the error message: 查询工作正常,没有“IGNORE”关键字,但当我添加它时,我收到错误消息:

"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" “错误代码:1064。您的SQL语法有错误;请检查与您的MySQL服务器版本对应的手册,以便在第1行的'IGNORE TABLE test_table ADD PRIMARY KEY(id)'附近使用正确的语法”

How do I fix this? 我该如何解决? Or how can I run that query and ignore any errors that might occur? 或者我如何运行该查询并忽略可能发生的任何错误? Thanks! 谢谢!

As of MySQL 5.7.4, the IGNORE clause for ALTER TABLE is removed and its use produces an error. 从MySQL 5.7.4开始,删除了ALTER TABLE的IGNORE子句,并且它的使用会产生错误。 Please check your version 请检查您的版本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM