Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error during django's syncdb on server

I have a full operating locale django app, but I'm having troubles while migrating to the site5 server.

When I launch django's syncdb command, all my models' tables are created, but then (I guess when it's creating relationship tables), I got the following error:

_mysql_exceptions.OperationalError: (1071, 'Specified key was too long; max key length is 1000 bytes')

I don't have any problem when I ask django to sync the locale db, this error only occurs in the server...

Any idea?

like image 497
dolma33 Avatar asked Dec 28 '10 16:12

dolma33


1 Answers

http://dev.mysql.com/doc/refman/5.0/en/create-index.html

Prefix support and lengths of prefixes (where supported) are storage engine dependent. For example, a prefix can be up to 1000 bytes long for MyISAM tables, and 767 bytes for InnoDB tables.

http://dev.mysql.com/doc/refman/5.0/en/charset-unicode.html

utf8, a UTF-8 encoding of the Unicode character set using one to three bytes per character

You exceed the limitation when you CREATE INDEX.

Although sqlall tells you that none of your key is longer than the limit, you may exceed the limitation because you are using utf8 which uses 3 bytes per character.

One more possible reason is that you have used 'unique_together' in the Meta. This will require a longer index which may cause the issue.

like image 168
Churix Avatar answered Nov 12 '22 14:11

Churix