Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Syntax error when running a MySQL CREATE TABLE statement [duplicate]

CREATE TABLE users (
user_id     INT(8) NOT NULL AUTO_INCREMENT,
user_name   VARCHAR(30) NOT NULL,
user_pass   VARCHAR(255) NOT NULL,
user_email  VARCHAR(255) NOT NULL,
user_date   DATETIME NOT NULL,
user_level  INT(8) NOT NULL,
UNIQUE INDEX user_name_unique (user_name),
PRIMARY KEY (user_id)
) TYPE=INNODB;

When running this query on the SQL server, I am getting the following error:

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=INNODB' at line 10

Any help on why this is coming up?

like image 592
user180857 Avatar asked Mar 08 '12 15:03

user180857


3 Answers

Instead of

TYPE=INNODB

set

Engine=InnoDB
like image 197
hsz Avatar answered Oct 17 '22 00:10

hsz


Use ENGINE=InnoDB;

http://dev.mysql.com/doc/refman/5.0/en/using-innodb-tables.html

like image 6
dotoree Avatar answered Oct 17 '22 00:10

dotoree


The manual for CREATE TABLE doesn't include TYPE; it seems to use:

ENGINE = INNODB;

And that is the default engine, so you don't really need to specify it.

like image 2
Jonathan Leffler Avatar answered Oct 17 '22 02:10

Jonathan Leffler