Database

Allikas: Juhised

Error message by creating a table[muuda]

MySQL Error Number 1005 Can’t create table ‘.\mydb\#sql-328_45.frm’ (errno: 150)

If you get this error while trying to create a foreign key, it can be pretty frustrating. The error about not being able to create a .frm file seems like it would be some kind of OS file permission error or something but this is not the case. This error has been reported as a bug on the MySQL developer list for ages, but it is actually just a misleading error message.

In every case this is due to something about the relationship that MySQL doesn’t like. Unfortunately it doesn’t specify what the exact issue is.

You may want to start by running the MySQL command “SHOW ENGINE INNODB STATUS” immediately after receiving the error. This command displays log info and error details.

Error with a foreign key[muuda]

Sometimes, there is a good thought to make the foreign key to accept NULL values.

Locking and transactions[muuda]

The locking procedure must take place outside the transaction or the transaction will not be handled as a transaction.