問題:
I am trying to import a .sql file and its failing on creating tables.我正在嘗試導入 .sql 文件,但在創建表時失敗。
Here's the query that fails:這是失敗的查詢:
CREATE TABLE `data` (
`id` int(10) unsigned NOT NULL,
`name` varchar(100) NOT NULL,
`value` varchar(15) NOT NULL,
UNIQUE KEY `id` (`id`,`name`),
CONSTRAINT `data_ibfk_1` FOREIGN KEY (`id`) REFERENCES `keywords` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
I exported the .sql from the same database, I dropped all the tables and now im trying to import it, why is it failing?我從同一個數據庫中導出了 .sql,我刪除了所有表,現在我試圖導入它,爲什麼它失敗了?
MySQL: Can't create table './dbname/data.frm' (errno: 150) MySQL:無法創建表 './dbname/data.frm' (errno: 150)
解決方案:
參考一: https://en.stackoom.com/question/H2Wj參考二: https://stackoom.com/question/H2Wj