0

我正在通过 phpMyAdmin 运行以下查询:

**CREATE TABLE folders (
  folder_id SERIAL NOT NULL,
  parent_id BIGINT,
  folder_name TEXT NOT NULL,
  PRIMARY KEY (folder_id),
FOREIGN KEY (parent_id) REFERENCES folders(folder_id) ON DELETE CASCADE
)ENGINE=InnoDB;**

但它给出了以下错误:
#1005 - Can't create table 'filesharingnew.folders' (errno: 150) 知道我哪里错了吗?

4

1 回答 1

2

来自 MySQL 文档,数字类型概述

SERIAL是 的别名BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE

您应该更改parent_idBIGINT UNSIGNED使其与引用的列匹配。

于 2012-05-29T13:48:31.247 回答