导入时出错 schema.sql

Error when importing schema.sql

我是 sql 的新手,目前我正在通过 XAMP 使用 phpMyAdmin,我认为它使用 mysql 所以如果我说错了请纠正我。 Anywhos,我正在尝试将 schema.sql 数据文件导入到我创建的名为 "test" 的数据库中,但在导入时出现错误:

它说

Import has been successfully finished, 1 queries executed. (schema.sql)

但是它也给我一个错误信息:

CREATE TABLE `population` (
 `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
 `location` varchar(150) NOT NULL,
 `slug` varchar(150) NOT NULL,
 `population` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8
MySQL said: Documentation

1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key

和:

Notice in .\import.php#704 Undefined variable: import_text Backtrace

我不确定是什么问题。我创建的数据库是完整的,里面什么都没有。

id 是有问题的自动列;自动列需要定义为键,例如唯一键或主键。在您的情况下,主键是个好主意,因为 - 好吧,这是您的 ID 列。

CREATE TABLE `population` (
 `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
 `location` varchar(150) NOT NULL,
 `slug` varchar(150) NOT NULL,
 `population` int(10) unsigned NOT NULL,
 PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8