在 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
Using "TYPE = InnoDB" in MySQL throws exception
提问by Gokul Nath KP
When I try to execute the following SQL
in MySQL
, I'm getting error:
当我尝试在 中执行以下内容SQL
时MySQL
,出现错误:
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 = Innodb
instead of TYPE = InnoDB
. TYPE
was removed in 5.1.
使用ENGINE = Innodb
代替TYPE = InnoDB
。TYPE
在 5.1 中被移除。
回答by nos
TYPE = InnoDB
was deprecated in MySQL 5.0
and was removed in My SQL 5.1
and later versions.
TYPE = InnoDB
已被弃用,MySQL 5.0
并在My SQL 5.1
以后的版本中被删除。
You now have to use ENGINE = InnoDB
你现在必须使用 ENGINE = InnoDB