2012-12-25 45 views
0
create table qbey (
idqbey int primary key auto_increment, 
bey int, 
users int, 
foreign key (users) references persons(idusers) on delete cascade on update cascade, 
foreign key (bey) references bey(idbey) on delete cascade on update cascade, 
); 

程序錯誤:爲什麼輸出錯誤,我不明白

error code: 1005 can't create table '.\soft_tj\qbey.frm' (errno:150)

+1

請至少花時間提問。你想做什麼?你可能做了什麼來嘗試解決錯誤?不鼓勵複製和粘貼代碼並期待解決方案。幫助我們幫助你。 – aLearner

回答

1

文檔解釋了這個錯誤,雖然它不是太容易找到:http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html

If you re-create a table that was dropped, it must have a definition that conforms to the foreign key constraints referencing it. It must have the right column names and types, and it must have indexes on the referenced keys, as stated earlier. If these are not satisfied, MySQL returns error number 1005 and refers to error 150 in the error message.

+0

我想創建一個表,但不起作用,一個錶鏈接到另外兩個表,這時我手動創建(表),但是並沒有鏈接它們 –

+0

謝謝大家,我意識到錯誤 –

相關問題