문제

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,
);

Program Error:

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

도움이 되었습니까?

해결책

The documentation explains this error, though it's not too easy to find: 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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top