django.db.utils.OperationalError: (1071, 'Specified key was too long; max key length is 767 bytes')
The previous two answers did not help in my case, so I'm posting my solution to my case when your limit is 1000
(i.e. 1071, 'Specified key was too long; max key length is 1000 bytes').
First of all, make sure you are working on utf8
encoding!
Then, navigate to your setting file my.ini
, find the line default-storage-engine=xxx
. If it is
default-storage-engine=MYISAM
please change to
default-storage-engine=InnoDB
Then, the problem should be solved.
The reason is simply because MYISAM
does not support key size greater than 1000 bytes.