Syntax error when running a MySQL CREATE TABLE statement
59,372
Solution 1
Instead of
TYPE=INNODB
set
Engine=InnoDB
Solution 2
Use ENGINE=InnoDB;
http://dev.mysql.com/doc/refman/5.0/en/using-innodb-tables.html
Solution 3
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.
Solution 4
Try the following query:
CREATE TABLE IF NOT EXISTS `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,
PRIMARY KEY (`user_id`),
UNIQUE KEY `user_name_unique` (`user_name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
Author by
user180857
Updated on June 12, 2020Comments
-
user180857 almost 4 years
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?