Using “TYPE = InnoDB” in MySQL throws exception

一个人想着一个人 提交于 2019-12-21 03:28:25

问题


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

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"

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

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

Any Suggestions / Alternatives ... ??


回答1:


Use ENGINE = Innodb instead of TYPE = InnoDB. TYPE was removed in 5.1.




回答2:


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

You now have to use ENGINE = InnoDB



来源:https://stackoverflow.com/questions/18338876/using-type-innodb-in-mysql-throws-exception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!