Unable to Create Table with TYPE=MYISAM
When attempting to create a table using the old TYPE syntax, such as:
CREATE TABLE dave_bannedwords( id INT( 11 ) NOT NULL AUTO_INCREMENT , word VARCHAR( 60 ) NOT NULL DEFAULT '', PRIMARY KEY ( id ) , KEY id( id ) ) TYPE = MYISAM ;
You may encounter an error like:
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 'TYPE=MyISAM' at line 6
Solution
As stated in the MySQL documentation for CREATE TABLE Syntax:
"The older TYPE option was synonymous with ENGINE. TYPE was deprecated in MySQL 4.0 and removed in MySQL 5.5. When upgrading to MySQL 5.5 or later, you must convert existing applications that rely on TYPE to use ENGINE instead."
Therefore, replace TYPE with ENGINE to create the table successfully:
CREATE TABLE dave_bannedwords( id INT(11) NOT NULL AUTO_INCREMENT, word VARCHAR(60) NOT NULL DEFAULT '', PRIMARY KEY (id), KEY id(id) -- this is superfluous in the presence of your PK, ergo unnecessary ) ENGINE = MyISAM ;
The above is the detailed content of Why is MyISAM Table Creation Failing with TYPE=MYISAM in MySQL 5.5 ?. For more information, please follow other related articles on the PHP Chinese website!