Nicholas Mc Lovinz Rothapfel Nicholas Mc Lovinz Rothapfel - 3 months ago 19
MySQL Question

1064 error in CREATE TABLE ... TYPE=MYISAM

Here is my error(if you need any more info just ask)-
Error
SQL query:

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 ;


MySQL said:


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

Answer

As documented under CREATE TABLE Syntax:

Note
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, you want:

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 ;