Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using "TYPE = InnoDB" in MySQL throws exception

Tags:

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 ... ??

like image 532
Gokul Nath KP Avatar asked Aug 20 '13 15:08

Gokul Nath KP


1 Answers

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

like image 131
Andrew Avatar answered Oct 12 '22 22:10

Andrew