Reply to comment

strict warning: Only variables should be passed by reference in /mnt/volume-sfo2-01/www/riceball.com/public/d/modules/book/book.module on line 559.

Django migrate MySQL error 1005 105, can't create table

When you have Django's migrations making foreign keys, you might hit this error, number 1005 or 105.

This may be happening because foreign key constraints can be applied only to identical columns that are unique.

So, check that they're unique, and add an index. (If you try to add the index, it'll fail if the values are not unique.)

ALTER TABLE X ADD CONSTRAINT UNIQUE INDEX (COLX);

Then, if you still get the error, check that the character sets are the same on both tables. (I don't think Django's db reflection keeps track of that.)

ALTER TABLE X SET CONVERT TO CHARACTER SET utf8;

Also, if the charsets are different, check the default charset for the table. Make sure it's "utf8".

ALTER DATABASE Y SET DEFAULT CHARACTER SET utf8;

Reply

The content of this field is kept private and will not be shown publicly.
  • Lines and paragraphs break automatically.

More information about formatting options

5 + 1 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.