1

我正在尝试创建一个表。我认为表格的规格从我正在运行的命令中应该很明显:

create table users{
    id mediumint unsigned not null auto_increment,
    username varchar(40) not null,
    sprinkles bigint unsigned not null,
    passhash binary(64) not null,
    passsalt binary(64) not null,
    x decimal(10,1),
    y decimal(10,1),
    primary key (id),
    unique key idx_unique_username (username)
} engine = INNODB DEFAULT character set = utf8 COLLATE = utf8_general_ci;

但是,当我尝试将其输入 MySQL 时,它给了我这个错误:

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 '{
id mediumint unsigned not null auto_increment,
username varchar(40) not null,
' at line 1

我的mysql版本是Ver 14.14 Distrib 5.5.31, for debian-linux-gnu (x86_64) using readline 6.2

4

2 回答 2

3

从括号形状开始。

提示:找到任何 create table示例并与您所拥有的进行比较

提示 2:当 mysql 返回有关不正确语法的错误时 - 它直接指向它无法解析的第一个标记。所以你的注意力应该被吸引到那个确切的字符和它之前的一些字符上。

于 2013-07-18T03:20:20.610 回答
0

换掉封装表格信息的 { } 括号,用 ( ) 括号替换它们,你应该很高兴。

于 2013-07-18T03:36:46.260 回答