外键添加在MySQL中失败,错误代码1005,编号150
|
因此,我试图像这样将新的外键添加到我的一个表中:
ALTER TABLE `UserTransactions`.`ExpenseBackTransactions`
ADD CONSTRAINT `FK_EBTx_CustomAccountID`
FOREIGN KEY (`CustomAccountID` )
REFERENCES `UserTransactions`.`CustomAccounts` (`CustomAccountID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
ADD INDEX `FK_EBTx_CustomAccountID` (`CustomAccountID` ASC) ;
而且我不断收到以下错误:
Error Code: 1005
Can\'t create table \'./UserTransactions/#sql-187a_29.frm\' (errno: 150)
过去,我已经对该表和其他表做了很多更改,这是我第一次遇到此问题。任何想法是什么原因造成的?
更新
我的SHOW INNODB STATUS
错误:
------------------------
LATEST FOREIGN KEY ERROR
------------------------
110525 15:56:36 Error in foreign key constraint of table UserTransactions/#sql-187a_2c:
FOREIGN KEY (`CustomAccountID` )
REFERENCES `UserTransactions`.`CustomAccounts` (`CustomAccountID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION
, ADD INDEX `FK_EBTx_CustomAccountID` (`CustomAccountID` ASC):
Cannot resolve table name close to:
(`CustomAccountID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION
, ADD INDEX `FK_EBTx_CustomAccountID` (`CustomAccountID` ASC)
没有找到相关结果
已邀请:
3 个回复
掏得透垦滩
广躺椽
和
是完全相同的类型,包括
(如果适用)。 如果这样做没有帮助,请张贴
和
脾萌