2010-05-03 49 views
1

我想执行这个简单的命令:无法创建一个表 - 错误1064(42000):你在你的SQL语法错误

create table foo 
(clo int primary key unsigned auto_increment); 

但我得到这个错误:

ERROR 1064 (42000): 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 'unsigned auto_increment)' at line 2

+1

仅供参考:http://dev.mysql.com/doc/refman/5.1/en/create-table.html。特别是,查看语法中的column_definition和data_type非终端。 – outis 2010-05-03 14:21:07

回答

1

我试图把intunsigned在一起,它工作得很好:

create table foo 
(clo int unsigned primary key auto_increment); 
+0

谢谢,这解决了问题。 – m4design 2010-05-03 14:40:08

0

你的语法有点Ø FF。试试这个:

create table `foo` (
    `clo` int unsigned auto_increment , 
    PRIMARY KEY(`clo`) 
) ENGINE=MYISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; 
相关问题