我試圖將我的網站數據庫導入到另一臺服務器時不斷收到此錯誤。MySQL:無法創建表'./myhairdev/catalog_product_index_website.frm'(錯誤:150)
錯誤:
Error at the line 3034:) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Catalog Product Website Index Table';
查詢:
CREATE TABLE `catalog_product_index_website` (
`website_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Website ID',
`website_date` date DEFAULT NULL COMMENT 'Website Date',
`rate` float DEFAULT '1' COMMENT 'Rate',
PRIMARY KEY (`website_id`),
KEY `IDX_CATALOG_PRODUCT_INDEX_WEBSITE_WEBSITE_DATE` (`website_date`),
CONSTRAINT `FK_CAT_PRD_IDX_WS_WS_ID_CORE_WS_WS_ID` FOREIGN KEY (`website_id`) REFERENCES `core_website` (`website_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Catalog Product Website Index Table'
MySQL: Can't create table './myhairdev/catalog_product_index_website.frm' (errno: 150)
我試圖在開始和SET FOREIGN_KEY_CHECKS = 1添加SET FOREIGN_KEY_CHECKS=0;
;最後還是得到了同樣的錯誤。
這裏是相關數據庫行的代碼:
DROP TABLE IF EXISTS `catalog_product_index_website`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `catalog_product_index_website` (
`website_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Website ID',
`website_date` date DEFAULT NULL COMMENT 'Website Date',
`rate` float DEFAULT '1' COMMENT 'Rate',
PRIMARY KEY (`website_id`),
KEY `IDX_CATALOG_PRODUCT_INDEX_WEBSITE_WEBSITE_DATE` (`website_date`),
CONSTRAINT `FK_CAT_PRD_IDX_WS_WS_ID_CORE_WS_WS_ID` FOREIGN KEY (`website_id`) REFERENCES `core_website` (`website_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Catalog Product Website Index Table';
/*!40101 SET character_set_client = @saved_cs_client */;
幫助幫助請:)
錯誤150通常是FK關係中引用列和引用列之間的數據類型不匹配。你只有上面的表格之一 - 確保'_site_id'在表格的_both_中是'smallint(5)unsigned','catalog_product_index_website'是在'core_website'之後創建的。 –