[GH-ISSUE #542] Syntax error or access violation: 1071 Specified key was too long; max key length is 1 #382

Closed
opened 2026-02-26 02:33:02 +03:00 by kerem · 4 comments
Owner

Originally created by @shahidkarimi on GitHub (Feb 19, 2017).
Original GitHub issue: https://github.com/koel/koel/issues/542

Hey, thanks for contributing to Koel! To save time for both of us, please make sure these checkboxes are checked before submitting the issue:

  • You have read and followed closely the Wiki, Upgrade Guide, as well as Troubleshooting
  • The issue has not been reported before
  • This is not a "how to install on Windows" or "why is my npm messed up" question
  • You're a cool person

All checked? Now also make sure your issue

  • Is associated with a version. Or better yet, a commit.
  • Is as detailed as possible (ahem... OS, browser, steps to reproduce, maybe?)
  • Includes the error output if it's a bug/error report ("Whoops!" is not very helpful, you know)
  • Is in English, 因为我不说中文。
Originally created by @shahidkarimi on GitHub (Feb 19, 2017). Original GitHub issue: https://github.com/koel/koel/issues/542 Hey, thanks for contributing to Koel! To save time for both of us, please make sure these checkboxes are checked before submitting the issue: - [ ] You have read and followed closely the [Wiki](https://github.com/phanan/koel/wiki), [Upgrade Guide](https://github.com/phanan/koel/releases), as well as [Troubleshooting](https://github.com/phanan/koel/wiki/Troubleshooting) - [ ] The issue has not been reported before - [ ] This is not a "how to install on Windows" or "why is my npm messed up" question - [ ] You're a cool person All checked? Now also make sure your issue - [ ] Is associated with a version. Or better yet, a commit. - [ ] Is as detailed as possible (ahem... OS, browser, steps to reproduce, maybe?) - [ ] Includes the error output if it's a bug/error report ("Whoops!" is not very helpful, you know) - [ ] Is in English, 因为我不说中文。
kerem closed this issue 2026-02-26 02:33:02 +03:00
Author
Owner

@MonBrice commented on GitHub (Feb 28, 2017):

Had the same issue and found out this might be a problem when using mysql lower than 5.7. or maria db (on debian systems e.g.). Laravel changed something in the default database character set, so you must add a key length to all primary or unique keys which will be created by the stuff in koel/database/migrations

Example:

$table->string('email', 100)->unique();

After that (3 or 4 additions), i was able to finish the installation, hope this helps.

<!-- gh-comment-id:283026272 --> @MonBrice commented on GitHub (Feb 28, 2017): Had the same issue and found out this might be a problem when using mysql lower than 5.7. or maria db (on debian systems e.g.). Laravel changed something in the default database character set, so you must add a key length to all primary or unique keys which will be created by the stuff in koel/database/migrations Example: `$table->string('email', 100)->unique(); ` After that (3 or 4 additions), i was able to finish the installation, hope this helps.
Author
Owner

@shahidkarimi commented on GitHub (Mar 10, 2017):

My MySQL version is 5.7.11 and still having the issue. @MonBrice

<!-- gh-comment-id:285775296 --> @shahidkarimi commented on GitHub (Mar 10, 2017): My MySQL version is 5.7.11 and still having the issue. @MonBrice
Author
Owner

@ghost commented on GitHub (Mar 24, 2017):

@shahidkarimi a workaround is to update the migration files so that anything that creates a string has a default length. It is tedious, yes, but I had the same issue and that was the only solution that worked for me.

This is an issue with Illuminate - the default string length defined by the Illuminate blueprint is larger than the default maximum length allowed by many MySQL servers because it assumes you want support for things such as emoji (that is to say, it uses the utf8mb4 charset).

See: https://github.com/laravel/framework/pull/16629

<!-- gh-comment-id:289035301 --> @ghost commented on GitHub (Mar 24, 2017): @shahidkarimi a workaround is to update the migration files so that anything that creates a string has a default length. It is tedious, yes, but I had the same issue and that was the only solution that worked for me. This is an issue with Illuminate - the default string length defined by the Illuminate blueprint is larger than the default maximum length allowed by many MySQL servers because it assumes you want support for things such as emoji (that is to say, it uses the `utf8mb4` charset). See: https://github.com/laravel/framework/pull/16629
Author
Owner

@ghost commented on GitHub (Mar 24, 2017):

@shahidkarimi actually, you may be able to set this in the boot function so that you don't have to update the migrations, as per http://stackoverflow.com/a/23786522

This is located in /path/to/koel/app/Providers/App/AppServiceProvider.php.

<!-- gh-comment-id:289036713 --> @ghost commented on GitHub (Mar 24, 2017): @shahidkarimi actually, you may be able to set this in the boot function so that you don't have to update the migrations, as per http://stackoverflow.com/a/23786522 This is located in `/path/to/koel/app/Providers/App/AppServiceProvider.php`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/koel-koel#382
No description provided.