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

Program Error:

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

aLearner
  • 1,051
  • 14
  • 30
  • 1
    Please at least take the time to ask a question. What are you trying to do? What have you maybe done to try resolving the error? Copying and pasting the code and expecting solutions is not encouraged. Help us help you. – aLearner Dec 25 '12 at 04:39

1 Answers1

1

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.

MikeB
  • 1,452
  • 14
  • 28
  • I want to create a table, but does not work, a table is linked to two other tables, at this time I create manually (table), but does not link them – Nasiba Sharipova Dec 25 '12 at 04:47