This question already has an answer here:
这个问题已经有了答案:
- 1064 error in CREATE TABLE … TYPE=MYISAM 4 answers
- 在CREATE TABLE中出错…TYPE=MYISAM 4答案
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:
在SQL服务器上运行此查询时,我得到以下错误:
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?
这是为什么?
4 个解决方案
#1
49
Instead of
而不是
TYPE=INNODB
set
集
Engine=InnoDB
#2
5
Use ENGINE=InnoDB;
使用引擎= InnoDB;
http://dev.mysql.com/doc/refman/5.0/en/using-innodb-tables.html
http://dev.mysql.com/doc/refman/5.0/en/using-innodb-tables.html
#3
2
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 ;
#4
1
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.
这是默认引擎,你不需要指定它。
#1
49
Instead of
而不是
TYPE=INNODB
set
集
Engine=InnoDB
#2
5
Use ENGINE=InnoDB;
使用引擎= InnoDB;
http://dev.mysql.com/doc/refman/5.0/en/using-innodb-tables.html
http://dev.mysql.com/doc/refman/5.0/en/using-innodb-tables.html
#3
2
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 ;
#4
1
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.
这是默认引擎,你不需要指定它。