django在服务器上的syncdb期间出错 [英] Error during django's syncdb on server
问题描述
我有一个完整的可运行区域设置django应用程序,但是在迁移到site5服务器时遇到了麻烦.
I have a full operating locale django app, but I'm having troubles while migrating to the site5 server.
当我启动django的syncdb
命令时,创建了我所有模型的表,但是随后(我想它是在创建关系表时创建的),出现以下错误:
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')
当我要求django同步语言环境数据库时,我没有任何问题,此错误仅发生在服务器中...
I don't have any problem when I ask django to sync the locale db, this error only occurs in the server...
有什么主意吗?
推荐答案
前缀支持和前缀长度(如果支持)取决于存储引擎.例如,对于MyISAM表,前缀的最大长度为1000字节,对于InnoDB表,前缀的最大长度为767字节.
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,一种Unicode字符集的UTF-8编码,每个字符使用一到三个字节 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. 尽管sqlall告诉您,您的密钥都不超过限制,但是您可能会超出限制,因为您使用的是utf8,每个字符使用3个字节. 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. 另一个可能的原因是您在Meta中使用了"unique_together".这将需要更长的索引,这可能会导致问题. 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. 这篇关于django在服务器上的syncdb期间出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!