-2
create table foo(
id UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
barbaz VARCHAR(50) CHARACTER SET utf8
)

[Edit]: OK I had accidentally removed the INT and I didn't realize it (these statements are generated automatically).[/Edit]

This gives me this error:

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, barbaz VARCHAR(50) CHARACTER SET '

Yeah, I'm using Maria DB as it replaces mysql in Fedora, but supposedly it's exactly the same syntax as Mysql.

Thanks for your help.

4

2 回答 2

2

UNSIGNED不是类型。您需要指定类型(最有可能INT):

id INT UNSIGNED ...
于 2013-09-06T13:41:38.420 回答
0

尝试这个:

  CREATE TABLE `foo`(  
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `barbaz` VARCHAR(50) CHARSET utf8,
  PRIMARY KEY (`id`)
);
于 2013-09-06T13:43:38.867 回答