在 MySQL 中使用“TYPE = InnoDB”抛出异常

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18338876/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 18:34:25  来源:igfitidea点击:

Using "TYPE = InnoDB" in MySQL throws exception

mysqlsqlmysql-5.0mysql-5.6

提问by Gokul Nath KP

When I try to execute the following SQLin MySQL, I'm getting error:

当我尝试在 中执行以下内容SQLMySQL,出现错误:

SQL:

查询语句:

        SQL = "CREATE TABLE Ranges (";
        SQL += "ID varchar(20) NOT NULL, ";
        SQL += "Descriptions longtext NULL, ";
        SQL += "Version_Number int NULL, ";
        SQL += "Row_Updated bigint NULL, ";
        SQL += "Last_Updated datetime NULL, ";
        SQL += "XML longtext NULL, ";
        SQL += "PRIMARY KEY (ID)";
        SQL += ") " + "TYPE = InnoDB";

Error:

错误:

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 "TYPE = InnoDB"

您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,了解在“TYPE = InnoDB”附近使用的正确语法

But if I remove "TYPE = InnoDB", then the query works fine.

但是如果我删除了"TYPE = InnoDB",那么查询就可以正常工作。

Previously the query worked fine, ie in MySQL 5.0. But when I upgraded to MySQL 5.6, I'm getting the above error.

以前查询工作正常,即在MySQL 5.0. 但是当我升级到 时MySQL 5.6,我收到了上述错误。

Any Suggestions / Alternatives ... ??

任何建议/替代方案......?

回答by Andrew

Use ENGINE = Innodbinstead of TYPE = InnoDB. TYPEwas removed in 5.1.

使用ENGINE = Innodb代替TYPE = InnoDBTYPE在 5.1 中被移除。

回答by nos

TYPE = InnoDBwas deprecated in MySQL 5.0and was removed in My SQL 5.1and later versions.

TYPE = InnoDB已被弃用,MySQL 5.0并在My SQL 5.1以后的版本中被删除。

You now have to use ENGINE = InnoDB

你现在必须使用 ENGINE = InnoDB