Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

1064 error in CREATE TABLE ... TYPE=MYISAM

Tags:

syntax

mysql

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

like image 481
Nicholas Mc Lovinz Rothapfel Avatar asked Sep 14 '12 16:09

Nicholas Mc Lovinz Rothapfel


1 Answers

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 ;
like image 74
eggyal Avatar answered Nov 20 '22 07:11

eggyal