question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mysql error 1071 : Specified key was too long; max key length is 767 bytes

See original GitHub issue

I’m using mysql with encoding set as utf8mb4.

Because of that, an index on a column larger than 191 characters will trigger a mysql error 1071 when migrating djcelery

django.db.utils.DatabaseError: (1071, 'Specified key was too long; max key length is 767 bytes')

I’ve tried tons of different stuff in order to make that work, but the only working solution I came up with was to fork the project, and reduce all columns that caused the error to 191 chars.

Any help here would be extremely appreciated !

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:18 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
datacordercommented, Jun 19, 2017

For avoiding this error in MariaDB just specify utf8_general_ci at creation time:

create database database_name default CHARACTER set utf8 default COLLATE utf8_general_ci;

If you can’t create a new database, just convert it. It will avoid this error.

0reactions
pjambetcommented, Jun 14, 2021

Closing this issue since it’s now been a few years and I haven’t worked with django-celery in a while

Read more comments on GitHub >

github_iconTop Results From Across the Web

MySQL Error #1071 - max key length is 767 bytes
767 bytes in MySQL version 5.6 (and prior versions), is the stated prefix limitation for InnoDB tables. It's 1,000 bytes long for MyISAM...
Read more >
How to resolve: Specified key was too long; max key length is ...
The length() function (http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_length) returns the number of bytes, not characters ...
Read more >
1071 Specified key was too long; max key length is 767 bytes
That exceed the 767 bytes limit for an index. The easy workaround is to limit the size of the key/index to 191 VARCHAR...
Read more >
Specified key was too long; max key length is 767 ... - YouTube
Free Linux cheat sheet found here: http://eepurl.com/dkRNM9This video shows how to correct the error : ERROR 1071 (42000): Specified key was ...
Read more >
Error message: The key was too long, MAX key length is 767 ...
Error message: The key was too long, MAX key length is 767 bytes. Resolved samuelmartin ... This error normally occurs on old MySQL...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found